mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
bf1ff29519
commited somewhere between vancouver and vegas @ 2135ft. Alt and 480mph.
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Diagnostics;
|
|
using System.IO;
|
|
using NLog;
|
|
using NLog.Config;
|
|
using Ninject;
|
|
|
|
namespace NzbDrone.Core.Instrumentation
|
|
{
|
|
public static class LogConfiguration
|
|
{
|
|
public static void Setup()
|
|
{
|
|
if (Debugger.IsAttached)
|
|
{
|
|
LogManager.ThrowExceptions = true;
|
|
}
|
|
|
|
LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false);
|
|
LogManager.ConfigurationReloaded += ((s, e) => BindCustomLoggers());
|
|
BindCustomLoggers();
|
|
}
|
|
|
|
private static void BindCustomLoggers()
|
|
{
|
|
#if Release
|
|
var exTarget = new ExceptioneerTarget();
|
|
LogManager.Configuration.AddTarget("Exceptioneer", exTarget);
|
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Error, exTarget));
|
|
#endif
|
|
|
|
|
|
var sonicTarget = CentralDispatch.NinjectKernel.Get<SubsonicTarget>();
|
|
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
|
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget));
|
|
|
|
LogManager.Configuration.Reload();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|