add console logging during startup

This commit is contained in:
Luke Pulverenti
2014-01-08 23:44:51 -05:00
parent dcc5f9ebab
commit 247a40fa61
12 changed files with 79 additions and 50 deletions

View File

@@ -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");
}
}
}