private async Task WriteToLoggerAsync(IHttpLog log)
 {
     using (Logger = new HttpSqlLogger())
     {
         await Logger.WriteHttpResponseAsync(log);
     }
 }
Esempio n. 2
0
 private async Task WriteToLoggerAsync(IHttpLog log)
 {
     using (Logger = new HttpSqlLogger())
     {
         await Logger.WriteHttpResponseAsync(log);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContextLogger{T}"/> class.
 /// </summary>
 /// <param name="loggerFactory">Logger instance creator.</param>
 /// <param name="httpLoggerFactory">HTTP request/response logger factory.</param>
 /// <param name="context">The request context.</param>
 public ContextLogger(
     ILoggerFactory loggerFactory,
     IHttpLoggerFactory httpLoggerFactory,
     HttpContext context)
 {
     _logger     = loggerFactory.ControllerLogger <T>(context);
     _httpLogger = httpLoggerFactory.Create(_logger);
     _context    = context;
 }
Esempio n. 4
0
        /// <summary>
        /// 处理顺序:<see cref="ConnectionHandler"/>=><see cref="RetryHandler"/>=><see cref="LoggingHandler"/>
        /// </summary>
        /// <param name="logger">通常日志记录者。记录一些类似“开始任务”或“进入特殊处理”之类的日志</param>
        /// <param name="httpLogger">HTTP日志记录者。每个Request与Response的头和内容都被记录在单独的文件中</param>
        public HttpClientConfigs(ILogger logger, IHttpLogger httpLogger)
        {
            Logger     = logger;
            HttpLogger = httpLogger;

            ConnectionHandler = new HttpConnectionHandler(Logger);
            LoggingHandler    = new HttpLoggingHandler(ConnectionHandler, HttpLogger);
            RetryHandler      = new HttpRetryHandler(LoggingHandler, Logger);
        }
Esempio n. 5
0
 /// <summary>
 /// 实例化一个HttpLoggingHandler对象,负责指定任务对象的http请求和响应的日志记录
 /// </summary>
 public HttpLoggingHandler(HttpMessageHandler innerHandler, IHttpLogger httpLogger) : base(innerHandler)
 {
     HttpLogger = httpLogger;
 }
Esempio n. 6
0
 public HttpLoggingService(IHttpLogger logger)
 {
     this.logger = logger;
 }