Is there a way to obtain a log-specific log event level? For example, if I logged
Log.Information("This is information")
Could print out a value or somehow obtain what level the log was?
Is there a way to obtain a log-specific log event level? For example, if I logged
Log.Information("This is information")
Could print out a value or somehow obtain what level the log was?
Copyright © 2021 Jogjafile Inc.
Probably, what you need is Serilog Formatting Output. That feature enables you to configure the log output as you want. For example, if you want to place the level and also the message in your log, you could do the following (remember to add in the project your Serilog Sinks dependency, Console in this case):
the example above will print in
stdout
the following:You could also use custom formatters to a specific tool ingestion (
ElasticsearchJsonFormatter
for example).