如何为ILogger.BeginScope配置文本?

时间:2018-08-31 07:16:47

标签: c# asp.net-core

我有一些这样的代码:

[HttpPost]
public string SomePostFromBody ( [FromForm] SomeClass obj )
{
    using (_logger.BeginScope("TEST"))
    {
        _logger.Log(LogLevel.Critical, "Some critical error");
        DoSmtClass doSmtClass = new DoSmtClass (  );
        doSmtClass.DoSmt ( _logger );
    }

        return "SomePostFromBody" + Guid.NewGuid ( );
    }
}

BeginScope始终在我的日志ConnectionId:0HLGF22CJ57E2 => RequestId:0HLGF22CJ57E2:00000001 RequestPath:/api/first => WebApplication.Controllers.FirstController.SomePostFromBody (WebApplication) => TEST中添加类似的内容。我该如何更改此文字?

0 个答案:

没有答案