0

i searched the document, and find nothing, all examples uses the global Log.

is serilog discourage users to define a static log in Class, and only a global Log is good enough?

but i fell that if i can get log message with the class name is more convenient.

after a heavy effort, i find something like Serilog.Log.ForContext<>(), it return a Serilog.ILogger.

i used it, but i don't know is it the correct way? no document says about it.

also, why it returns its Serilog.ILogger, and not Microsoft's ILogger?

if uses the injected Microsoft ILogger along with a static Serilog.ILogger, it seems strange. some log use log.Information, some use log.LogInformation, some use log.Info. some use Log.Warn, some use Log.Warning.

why not unify the interface to Microsoft's ILogger?

years ago, i write java. all log lib such as log4j, logback, log4j2 can use a same interface as Slf4j.

why it acts so strange in .net? NLog has its own template way, Serilog has its own template way, and Microsoft has its own template way, why?

it is only a log, why so strange and so many differenct write ways?

bthulu
  • 1
  • 1
  • 2
    You're asking a lot of questions here. Do you know about https://github.com/serilog/serilog-extensions-logging? – gunr2171 Jun 24 '22 at 02:04
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jun 24 '22 at 04:26
  • Read these: https://stackoverflow.com/questions/71234098/serilog-forcontext-not-available-via-in-service-worker-class https://github.com/serilog/serilog-aspnetcore/issues/104 https://github.com/serilog/serilog/issues/1237 then ask an actual question with some code that is not working fully yet – Ruben Bartelink Jun 24 '22 at 07:28

0 Answers0