mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
fixed a bunch of things. added basic support for file scanning. logs are now avilable in the UI
This commit is contained in:
40
NzbDrone.Core/Instrumentation/LogConfiguration.cs
Normal file
40
NzbDrone.Core/Instrumentation/LogConfiguration.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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()
|
||||
{
|
||||
var exTarget = new ExceptioneerTarget();
|
||||
LogManager.Configuration.AddTarget("Exceptioneer", exTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Error, exTarget));
|
||||
|
||||
var sonicTarget = CentralDispatch.NinjectKernel.Get<SubsonicTarget>();
|
||||
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget));
|
||||
|
||||
LogManager.Configuration.Reload();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user