【发布时间】:2022-03-11 16:25:37
【问题描述】:
我们发现serilog中存在restrictedToMinimumLevel属性,但它也支持最高级别属性吗?
之前我们使用了NLog,它具有最小和最大日志记录级别(https://github.com/NLog/NLog/wiki/Configuration-file#rules)。
我们希望从控制台中的debug to information 和文件中的information to warning 和数据库中的errors 登录.
我们可以使用 appsettings.json 做到这一点吗?
我们使用的是 dotnet core 2.2。
非常感谢任何帮助。
【问题讨论】:
-
有一个
.Filter.ByIncluding和ByExcluding,可以访问关卡。没有通过 appsettings.json 使用它,但一般来说,配置 DSL 在 json 中有等价物