本文整理汇总了C#中IHttpContext.OutputSavedLogItems方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpContext.OutputSavedLogItems方法的具体用法?C# IHttpContext.OutputSavedLogItems怎么用?C# IHttpContext.OutputSavedLogItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpContext
的用法示例。
在下文中一共展示了IHttpContext.OutputSavedLogItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleActualRequest
public void HandleActualRequest(IHttpContext ctx)
{
var sw = Stopwatch.StartNew();
bool ravenUiRequest = false;
try
{
ravenUiRequest = DispatchRequest(ctx);
}
catch (Exception e)
{
HandleException(ctx, e);
logger.Warn("Error on request", e);
}
finally
{
ctx.FinalizeResonse();
// we filter out requests for the UI because they fill the log with information
// we probably don't care about
if (ravenUiRequest == false)
{
var curReq = Interlocked.Increment(ref reqNum);
logger.DebugFormat("Request #{0,4:#,0}: {1,-7} - {2,5:#,0} ms - {5,-10} - {3} - {4}",
curReq, ctx.Request.HttpMethod, sw.ElapsedMilliseconds, ctx.Response.StatusCode,
ctx.Request.Url.PathAndQuery,
currentTenantId.Value);
ctx.OutputSavedLogItems(logger);
}
}
}
示例2: FinalizeRequestProcessing
private void FinalizeRequestProcessing(IHttpContext ctx, Stopwatch sw, bool ravenUiRequest)
{
LogHttpRequestStatsParams logHttpRequestStatsParam = null;
try
{
logHttpRequestStatsParam = new LogHttpRequestStatsParams(
sw,
ctx.Request.Headers,
ctx.Request.HttpMethod,
ctx.Response.StatusCode,
ctx.Request.Url.PathAndQuery);
}
catch (Exception e)
{
logger.WarnException("Could not gather information to log request stats", e);
}
ctx.FinalizeResponse();
if (ravenUiRequest || logHttpRequestStatsParam == null || sw == null)
return;
sw.Stop();
LogHttpRequestStats(logHttpRequestStatsParam);
ctx.OutputSavedLogItems(logger);
}
示例3: LogHttpRequestStats
private void LogHttpRequestStats(IHttpContext ctx, Stopwatch sw, bool ravenUiRequest)
{
if (ravenUiRequest)
return;
// we filter out requests for the UI because they fill the log with information
// we probably don't care about them anyway. That said, we do output them if they take too
// long.
if (ctx.Request.Headers["Raven-Timer-Request"] == "true" && sw.ElapsedMilliseconds <= 25)
return;
var curReq = Interlocked.Increment(ref reqNum);
logger.DebugFormat("Request #{0,4:#,0}: {1,-7} - {2,5:#,0} ms - {5,-10} - {3} - {4}",
curReq, ctx.Request.HttpMethod, sw.ElapsedMilliseconds, ctx.Response.StatusCode,
ctx.Request.Url.PathAndQuery,
currentTenantId.Value);
ctx.OutputSavedLogItems(logger);
}