你的位置: 码友网首页 / 资讯源列表 / asp.net core 自定义基于 HttpContext 的 Serilog Enricher

关于[asp.net core 自定义基于 HttpContext 的 Serilog Enricher]的摘要:

asp.net core 自定义基于 HttpContext 的 Serilog EnricherIntro通过 HttpContext 我们可以拿到很多有用的信息,比如 Path/QueryString/RequestHeader 等请求信息, StatusCode/ResponseHeader 等响应信息,借助 HttpContext 我们可以在日志中记录很多有用的信息,于是需要自定义一个基于 HttpContext 的 Enricher实现代码public class HttpContextEnricher : ILogEventEnricher{private readonly ISe...

原文地址: https://www.cnblogs.com/weihanli/p/12105239.html

收录时间: 2019-12-27 浏览量: 1686 分类: ASP.NET Core

| 0 收藏 | 0