From b3f22fd05237e589d79e3f06de7e5db27effcc93 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 11 Nov 2016 00:41:05 -0500 Subject: update server core project --- Emby.Server.Core/UnhandledExceptionWriter.cs | 38 ++++++++++++++++++++++ Emby.Server.Core/project.json | 2 +- .../MediaBrowser.Server.Startup.Common.csproj | 1 - .../UnhandledExceptionWriter.cs | 38 ---------------------- 4 files changed, 39 insertions(+), 40 deletions(-) create mode 100644 Emby.Server.Core/UnhandledExceptionWriter.cs delete mode 100644 MediaBrowser.Server.Startup.Common/UnhandledExceptionWriter.cs diff --git a/Emby.Server.Core/UnhandledExceptionWriter.cs b/Emby.Server.Core/UnhandledExceptionWriter.cs new file mode 100644 index 000000000..5147be9e7 --- /dev/null +++ b/Emby.Server.Core/UnhandledExceptionWriter.cs @@ -0,0 +1,38 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Logging; +using System; +using System.IO; + +namespace Emby.Server.Core +{ + public class UnhandledExceptionWriter + { + private readonly IApplicationPaths _appPaths; + private readonly ILogger _logger; + private readonly ILogManager _logManager; + + public UnhandledExceptionWriter(IApplicationPaths appPaths, ILogger logger, ILogManager logManager) + { + _appPaths = appPaths; + _logger = logger; + _logManager = logManager; + } + + public void Log(Exception ex) + { + _logger.ErrorException("UnhandledException", ex); + _logManager.Flush(); + + var path = Path.Combine(_appPaths.LogDirectoryPath, "unhandled_" + Guid.NewGuid() + ".txt"); + Directory.CreateDirectory(Path.GetDirectoryName(path)); + + var builder = LogHelper.GetLogMessage(ex); + + // Write to console just in case file logging fails + Console.WriteLine("UnhandledException"); + Console.WriteLine(builder.ToString()); + + File.WriteAllText(path, builder.ToString()); + } + } +} diff --git a/Emby.Server.Core/project.json b/Emby.Server.Core/project.json index 41f29ca47..ae3ff5203 100644 --- a/Emby.Server.Core/project.json +++ b/Emby.Server.Core/project.json @@ -8,7 +8,7 @@ "frameworks": { "net46": { "frameworkAssemblies": { - + "System.Runtime": "4.0.0" }, "dependencies": { "MediaBrowser.Model": { diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 8976582b1..f5f561065 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -172,7 +172,6 @@ - diff --git a/MediaBrowser.Server.Startup.Common/UnhandledExceptionWriter.cs b/MediaBrowser.Server.Startup.Common/UnhandledExceptionWriter.cs deleted file mode 100644 index 696c3892e..000000000 --- a/MediaBrowser.Server.Startup.Common/UnhandledExceptionWriter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Logging; -using System; -using System.IO; - -namespace MediaBrowser.Server.Startup.Common -{ - public class UnhandledExceptionWriter - { - private readonly IApplicationPaths _appPaths; - private readonly ILogger _logger; - private readonly ILogManager _logManager; - - public UnhandledExceptionWriter(IApplicationPaths appPaths, ILogger logger, ILogManager logManager) - { - _appPaths = appPaths; - _logger = logger; - _logManager = logManager; - } - - public void Log(Exception ex) - { - _logger.ErrorException("UnhandledException", ex); - _logManager.Flush(); - - var path = Path.Combine(_appPaths.LogDirectoryPath, "unhandled_" + Guid.NewGuid() + ".txt"); - Directory.CreateDirectory(Path.GetDirectoryName(path)); - - var builder = LogHelper.GetLogMessage(ex); - - // Write to console just in case file logging fails - Console.WriteLine("UnhandledException"); - Console.WriteLine(builder.ToString()); - - File.WriteAllText(path, builder.ToString()); - } - } -} -- cgit v1.2.3