jellyfin/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs

23 lines
863 B
C#
Raw Normal View History

2014-07-08 17:46:11 -07:00
using MediaBrowser.Model.Logging;
2013-12-07 08:52:38 -07:00
using System;
2015-07-08 09:10:34 -07:00
using System.Globalization;
2013-12-07 08:52:38 -07:00
namespace MediaBrowser.Server.Implementations.HttpServer
{
public static class LoggerUtils
{
/// <summary>
/// Logs the response.
/// </summary>
/// <param name="logger">The logger.</param>
2014-07-08 17:46:11 -07:00
/// <param name="statusCode">The status code.</param>
2013-12-07 08:52:38 -07:00
/// <param name="url">The URL.</param>
/// <param name="endPoint">The end point.</param>
/// <param name="duration">The duration.</param>
2014-07-08 17:46:11 -07:00
public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
2013-12-07 08:52:38 -07:00
{
2015-10-28 12:14:46 -07:00
logger.Info("HTTP Response {0} to {1}. Time: {2}ms. {3}", statusCode, endPoint, Convert.ToInt32(duration.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), url);
2013-12-07 08:52:38 -07:00
}
}
}