diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-09-25 14:32:36 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-09-25 14:32:36 -0400 |
| commit | c02c0db35af078e1a78897aecdade2efe57d3f06 (patch) | |
| tree | af9ef64305efd2e353a202c27b188d2c44cd9b5b /MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs | |
| parent | c6e57c6448c04998bcae5a906e7a064300542e75 (diff) | |
| parent | 2d9b48d00fd31aaa96676c82a054b2794493fbf9 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs index f6547dec1..4f795fdd5 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs @@ -314,6 +314,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// <param name="context">The CTX.</param> private async void ProcessHttpRequestAsync(HttpListenerContext context) { + var date = DateTime.Now; + LogHttpRequest(context); if (context.Request.IsWebSocketRequest) @@ -360,7 +362,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer var url = context.Request.Url.ToString(); var endPoint = context.Request.RemoteEndPoint; - LogResponse(context, url, endPoint); + var duration = DateTime.Now - date; + + LogResponse(context, url, endPoint, duration); } catch (Exception ex) @@ -461,14 +465,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// <param name="ctx">The CTX.</param> /// <param name="url">The URL.</param> /// <param name="endPoint">The end point.</param> - private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint) + /// <param name="duration">The duration.</param> + private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint, TimeSpan duration) { if (!EnableHttpRequestLogging) { return; } - var statusode = ctx.Response.StatusCode; + var statusCode = ctx.Response.StatusCode; var log = new StringBuilder(); @@ -476,7 +481,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer log.AppendLine("Headers: " + string.Join(",", ctx.Response.Headers.AllKeys.Select(k => k + "=" + ctx.Response.Headers[k]))); - var msg = "Http Response Sent (" + statusode + ") to " + endPoint; + var responseTime = string.Format(". Response time: {0} ms", duration.TotalMilliseconds); + + var msg = "Response code " + statusCode + " sent to " + endPoint + responseTime; _logger.LogMultiline(msg, LogSeverity.Debug, log); } |
