当前位置: 首页>>代码示例>>C#>>正文


C# IHttpContext.OutputSavedLogItems方法代码示例

本文整理汇总了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);

                }
            }
        }
开发者ID:eldersantos,项目名称:ravendb,代码行数:31,代码来源:HttpServer.cs

示例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);
		}
开发者ID:urbanfly,项目名称:ravendb,代码行数:27,代码来源:HttpServer.cs

示例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);
    	}
开发者ID:philiphoy,项目名称:ravendb,代码行数:18,代码来源:HttpServer.cs


注:本文中的IHttpContext.OutputSavedLogItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。