Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read current Serilog's configuration

Tags:

c#

serilog

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)

like image 499
Julian Avatar asked Oct 15 '22 13:10

Julian


1 Answers

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

like image 94
Nicholas Blumhardt Avatar answered Oct 20 '22 22:10

Nicholas Blumhardt