diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations/Logging/NlogManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/Logging/NlogManager.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs index fb7fd1698..40dc380ea 100644 --- a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs +++ b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs @@ -187,7 +187,7 @@ namespace MediaBrowser.Common.Implementations.Logging LogFilePath = Path.Combine(LogDirectory, LogFilePrefix + "-" + decimal.Round(DateTime.Now.Ticks / 10000000) + ".log"); Directory.CreateDirectory(Path.GetDirectoryName(LogFilePath)); - + AddFileTarget(LogFilePath, level); LogSeverity = level; @@ -212,5 +212,26 @@ namespace MediaBrowser.Common.Implementations.Logging { LogManager.Flush(); } + + + public void AddConsoleOutput() + { + var target = new ConsoleTarget() + { + Layout = "${level}, ${logger}, ${message}", + Error = false + }; + + RemoveTarget("ConsoleTarget"); + + target.Name = "ConsoleTarget"; + + AddLogTarget(target, LogSeverity); + } + + public void RemoveConsoleOutput() + { + RemoveTarget("ConsoleTarget"); + } } } |
