Read current Serilog's configuration

半世苍凉 提交于 2021-01-27 05:36:28

问题


Is there a property / method in Serilog where I could (programmatically) check the current configuration? (sinks, minimum level)

e.g. if have this config:

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Debug()
    .WriteTo.File("log.txt")
    .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information)
    .CreateLogger();

How could I read this config later?

(In my case the config is dynamically created outside my application)


回答1:


No, there's no reflective way to examine Serilog configuration.



来源:https://stackoverflow.com/questions/56902169/read-current-serilogs-configuration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!