mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Added progress messaging, using info logging
Also extension methods for complete and failed (for coloured UI messaging)
This commit is contained in:
parent
eeda4e83f9
commit
c928ccb201
21 changed files with 191 additions and 32 deletions
40
NzbDrone.Common/Instrumentation/LoggerExtensions.cs
Normal file
40
NzbDrone.Common/Instrumentation/LoggerExtensions.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Messaging.Tracking;
|
||||
|
||||
namespace NzbDrone.Common.Instrumentation
|
||||
{
|
||||
public static class LoggerExtensions
|
||||
{
|
||||
public static void Complete(this Logger logger, string message)
|
||||
{
|
||||
var logEvent = new LogEventInfo(LogLevel.Info, logger.Name, message);
|
||||
logEvent.Properties.Add("Status", ProcessState.Completed);
|
||||
|
||||
logger.Log(logEvent);
|
||||
}
|
||||
|
||||
public static void Complete(this Logger logger, string message, params object[] args)
|
||||
{
|
||||
var formattedMessage = String.Format(message, args);
|
||||
Complete(logger, formattedMessage);
|
||||
}
|
||||
|
||||
public static void Failed(this Logger logger, string message)
|
||||
{
|
||||
var logEvent = new LogEventInfo(LogLevel.Info, logger.Name, message);
|
||||
logEvent.Properties.Add("Status", ProcessState.Failed);
|
||||
|
||||
logger.Log(logEvent);
|
||||
}
|
||||
|
||||
public static void Failed(this Logger logger, string message, params object[] args)
|
||||
{
|
||||
var formattedMessage = String.Format(message, args);
|
||||
Failed(logger, formattedMessage);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue