mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-26 20:16:33 +00:00
removed static logger
This commit is contained in:
@@ -143,7 +143,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<TConfigurationType>(ApplicationPaths.SystemConfigurationFilePath));
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<TConfigurationType>(ApplicationPaths.SystemConfigurationFilePath, Logger));
|
||||
return _configuration;
|
||||
}
|
||||
protected set
|
||||
@@ -441,8 +441,6 @@ namespace MediaBrowser.Common.Kernel
|
||||
|
||||
AddLogTarget(logFile, "ApplicationLogFile");
|
||||
|
||||
Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("App");
|
||||
|
||||
OnLoggerLoaded();
|
||||
}
|
||||
|
||||
@@ -590,7 +588,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
|
||||
try
|
||||
{
|
||||
plugin.Initialize(this);
|
||||
plugin.Initialize(this, Logging.LogManager.GetLogger(plugin.GetType().Name));
|
||||
|
||||
Logger.Info("{0} {1} initialized.", plugin.Name, plugin.Version);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Kernel
|
||||
{
|
||||
@@ -38,6 +39,25 @@ namespace MediaBrowser.Common.Kernel
|
||||
/// <returns>Task{`1}.</returns>
|
||||
protected abstract Task<TReturnDataType> GetDataToSend(TStateType state);
|
||||
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasePeriodicWebSocketListener{TStateType}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
protected BasePeriodicWebSocketListener(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the message internal.
|
||||
/// </summary>
|
||||
@@ -71,7 +91,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
|
||||
var cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
Logger.LogInfo("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
Logger.Info("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
|
||||
var timer = new Timer(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite);
|
||||
|
||||
@@ -135,7 +155,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error sending web socket message {0}", ex, Name);
|
||||
Logger.ErrorException("Error sending web socket message {0}", ex, Name);
|
||||
DisposeConnection(tuple);
|
||||
}
|
||||
finally
|
||||
@@ -167,7 +187,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
/// <param name="connection">The connection.</param>
|
||||
private void DisposeConnection(Tuple<WebSocketConnection, CancellationTokenSource, Timer, TStateType, SemaphoreSlim> connection)
|
||||
{
|
||||
Logger.LogInfo("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
Logger.Info("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user