1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00
Sonarr/NzbDrone.Test.Common/LoggingTest.cs

30 lines
985 B
C#
Raw Normal View History

2011-10-24 07:54:09 +02:00
using NLog;
using NLog.Config;
using NzbDrone.Common;
namespace NzbDrone.Test.Common
{
public abstract class LoggingTest
2011-10-24 07:54:09 +02:00
{
protected static void InitLogging()
2011-10-24 07:54:09 +02:00
{
2011-11-08 08:01:52 +01:00
if (LogManager.Configuration == null || LogManager.Configuration is XmlLoggingConfiguration)
{
LogManager.Configuration = new LoggingConfiguration();
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
LogConfiguration.RegisterUdpLogger();
2011-10-24 07:54:09 +02:00
2011-11-08 08:01:52 +01:00
RegisterExceptionVerification();
}
2011-10-24 07:54:09 +02:00
}
private static void RegisterExceptionVerification()
{
var exceptionVerification = new ExceptionVerification();
LogManager.Configuration.AddTarget("ExceptionVerification", exceptionVerification);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, exceptionVerification));
LogConfiguration.Reload();
}
}
}