diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-08 23:44:51 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-08 23:44:51 -0500 |
| commit | 247a40fa614241b52babb29bc03b0afd9a9031f9 (patch) | |
| tree | 5e82b401988d9246d8da2e59a9e29d0c2627c743 /MediaBrowser.Common.Implementations/Logging/NlogManager.cs | |
| parent | dcc5f9ebab9fe0260d6886d79284ccdce83a4814 (diff) | |
add console logging during startup
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"); + } } } |
