Moved some entities to the main project

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-09-10 21:34:02 -04:00
parent b1df61f7ce
commit 2467ca9668
73 changed files with 212 additions and 190 deletions

View File

@@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -85,22 +86,18 @@ namespace MediaBrowser.Common.Kernel
await ReloadComposableParts().ConfigureAwait(false);
}
/// <summary>
/// Gets or sets the path to the current log file
/// </summary>
public static string LogFilePath { get; set; }
private void ReloadLogger()
{
DisposeLogger();
DateTime now = DateTime.Now;
LogFilePath = Path.Combine(ApplicationPaths.LogDirectoryPath, "log-" + now.ToString("dMyyyy") + "-" + now.Ticks + ".log");
string logFilePath = Path.Combine(ApplicationPaths.LogDirectoryPath, "log-" + now.ToString("dMyyyy") + "-" + now.Ticks + ".log");
FileStream fs = new FileStream(LogFilePath, FileMode.Append, FileAccess.Write, FileShare.Read);
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));
Trace.AutoFlush = true;
Logger.LoggerInstance = new StreamLogger(fs);
Logger.LoggerInstance = new TraceLogger();
}
/// <summary>
@@ -264,6 +261,8 @@ namespace MediaBrowser.Common.Kernel
/// </summary>
private void DisposeLogger()
{
Trace.Listeners.Clear();
if (Logger.LoggerInstance != null)
{
Logger.LoggerInstance.Dispose();