mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-30 15:37:55 +02:00
Nzbdrone.exe file logging
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
@@ -74,6 +75,20 @@ namespace NzbDrone.Common
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void RegisterFileLogger(string fileName)
|
||||
{
|
||||
var fileTarget = new FileTarget();
|
||||
fileTarget.AutoFlush = true;
|
||||
fileTarget.ConcurrentWrites = false;
|
||||
fileTarget.FileName = fileName;
|
||||
fileTarget.KeepFileOpen = false;
|
||||
fileTarget.Layout = "${longdate} - ${logger}: ${message} ${exception:format=ToString}";
|
||||
|
||||
LogManager.Configuration.AddTarget(fileTarget.GetType().Name, fileTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
|
||||
}
|
||||
|
||||
public static void RegisterExceptioneer()
|
||||
{
|
||||
if (EnviromentProvider.IsProduction)
|
||||
|
Reference in New Issue
Block a user