|
|
|
@ -33,22 +33,25 @@ namespace NzbDrone.Core.Instrumentation
|
|
|
|
|
|
|
|
|
|
LogManager.Configuration.AddTarget("DbLogger", target);
|
|
|
|
|
LogManager.Configuration.LoggingRules.Add(Rule);
|
|
|
|
|
LogManager.ConfigurationReloaded += OnLogManagerOnConfigurationReloaded;
|
|
|
|
|
LogManager.ConfigurationChanged += OnLogManagerOnConfigurationChanged;
|
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UnRegister()
|
|
|
|
|
{
|
|
|
|
|
LogManager.ConfigurationReloaded -= OnLogManagerOnConfigurationReloaded;
|
|
|
|
|
LogManager.ConfigurationChanged -= OnLogManagerOnConfigurationChanged;
|
|
|
|
|
LogManager.Configuration.RemoveTarget("DbLogger");
|
|
|
|
|
LogManager.Configuration.LoggingRules.Remove(Rule);
|
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
|
Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnLogManagerOnConfigurationReloaded(object sender, LoggingConfigurationReloadedEventArgs args)
|
|
|
|
|
private void OnLogManagerOnConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
Register();
|
|
|
|
|
if (args.ActivatedConfiguration != null)
|
|
|
|
|
{
|
|
|
|
|
Register();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LoggingRule Rule { get; set; }
|
|
|
|
|