Blog.Common.Web.Attributes.ApiRequestLoggerAttribute.GetLogMessage C# (CSharp) Method

GetLogMessage() private method

private GetLogMessage ( System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext, long duration ) : string
actionExecutedContext System.Web.Http.Filters.HttpActionExecutedContext
duration long
return string
        private string GetLogMessage(HttpActionExecutedContext actionExecutedContext, long duration)
        {
            var sb = new StringBuilder();
            sb.AppendLine("============================================================");
            sb.AppendLine(string.Format("From: {0}", actionExecutedContext.Request.Headers.From));
            sb.AppendLine(string.Format("Referrer: {0}", actionExecutedContext.Request.Headers.Referrer));
            sb.AppendLine(string.Format("Host: {0}", actionExecutedContext.Request.Headers.Host));
            sb.AppendLine(string.Format("User Agent: {0}", actionExecutedContext.Request.Headers.UserAgent));
            sb.AppendLine(string.Format("Date: {0}", actionExecutedContext.Request.Headers.Date));
            sb.AppendLine(string.Format("IsSuccess: {0}", actionExecutedContext.Response.IsSuccessStatusCode));
            sb.AppendLine(string.Format("Controller: {0}", actionExecutedContext.ActionContext.ControllerContext.ControllerDescriptor.ControllerName));
            sb.AppendLine(string.Format("Route: {0}", GetActionRoute(actionExecutedContext.ActionContext.ControllerContext)));
            sb.AppendLine(string.Format("Request Duration: {0} milliseconds", duration));
            sb.AppendLine("============================================================");

            return sb.ToString();
        }