aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2018-12-30 17:29:02 -0500
committerGitHub <noreply@github.com>2018-12-30 17:29:02 -0500
commit1f02cf4b7e13c932bc30968cbb74b71885fd3eb7 (patch)
tree2fbf2e570340765abd40b5ad8e491f1f212699c0 /Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
parent7ad023143062c1995178e5700961b553822bd5af (diff)
parent4c95aee52eda793d1e013164cc0fde9eb609f894 (diff)
Merge pull request #285 from Bond-009/logging
Use Serilog to handle logging
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs28
1 files changed, 14 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 70a233c6f..704b7f8a6 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -252,11 +252,11 @@ namespace Emby.Server.Implementations.HttpServer
if (logExceptionStackTrace)
{
- _logger.ErrorException("Error processing request", ex);
+ _logger.LogError(ex, "Error processing request");
}
else if (logExceptionMessage)
{
- _logger.Error(ex.Message);
+ _logger.LogError(ex.Message);
}
var httpRes = httpReq.Response;
@@ -272,9 +272,9 @@ namespace Emby.Server.Implementations.HttpServer
httpRes.ContentType = "text/html";
await Write(httpRes, NormalizeExceptionMessage(ex.Message)).ConfigureAwait(false);
}
- catch
+ catch (Exception errorEx)
{
- //_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
+ _logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response)");
}
}
@@ -320,10 +320,10 @@ namespace Emby.Server.Implementations.HttpServer
if (_listener != null)
{
- _logger.Info("Stopping HttpListener...");
+ _logger.LogInformation("Stopping HttpListener...");
var task = _listener.Stop();
Task.WaitAll(task);
- _logger.Info("HttpListener stopped");
+ _logger.LogInformation("HttpListener stopped");
}
}
@@ -713,12 +713,12 @@ namespace Emby.Server.Implementations.HttpServer
var pathParts = pathInfo.TrimStart('/').Split('/');
if (pathParts.Length == 0)
{
- _logger.Error("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
+ _logger.LogError("Path parts empty for PathInfo: {pathInfo}, Url: {RawUrl}", pathInfo, httpReq.RawUrl);
return null;
}
string contentType;
- var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, _logger, out contentType);
+ var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out contentType);
if (restPath != null)
{
@@ -729,7 +729,7 @@ namespace Emby.Server.Implementations.HttpServer
};
}
- _logger.Error("Could not find handler for {0}", pathInfo);
+ _logger.LogError("Could not find handler for {pathInfo}", pathInfo);
return null;
}
@@ -783,7 +783,7 @@ namespace Emby.Server.Implementations.HttpServer
ServiceController = new ServiceController();
- _logger.Info("Calling ServiceStack AppHost.Init");
+ _logger.LogInformation("Calling ServiceStack AppHost.Init");
var types = services.Select(r => r.GetType()).ToArray();
@@ -853,7 +853,7 @@ namespace Emby.Server.Implementations.HttpServer
//using (var reader = new StreamReader(stream))
//{
// var json = reader.ReadToEnd();
- // Logger.Info(json);
+ // logger.LogInformation(json);
// return _jsonSerializer.DeserializeFromString(json, type);
//}
return _jsonSerializer.DeserializeFromStreamAsync(stream, type);
@@ -919,7 +919,7 @@ namespace Emby.Server.Implementations.HttpServer
return Task.CompletedTask;
}
- //_logger.Debug("Websocket message received: {0}", result.MessageType);
+ _logger.LogDebug("Websocket message received: {0}", result.MessageType);
var tasks = _webSocketListeners.Select(i => Task.Run(async () =>
{
@@ -929,7 +929,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch (Exception ex)
{
- _logger.ErrorException("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType ?? string.Empty);
+ _logger.LogError(ex, "{0} failed processing WebSocket message {1}", i.GetType().Name, result.MessageType ?? string.Empty);
}
}));