-
Notifications
You must be signed in to change notification settings - Fork 2
How to log
Barbara Post edited this page Mar 1, 2018
·
1 revision
We've integrated Serilog by associating it to the logger factory that ASP.NET Core creates at application startup.
Log level is defined in appsettings.json
of web application, sections "Logging" and "Serilog".
To log a custom message, inject ILoggerFactory
(Microsoft.Extensions.Logging
) into your class' constructor. Then instantiate your logger:
Microsoft.Extensions.Logging.ILogger myLogger = _loggerFactory.CreateLogger(GetType().FullName);
and log:
myLogger.LogInformation("Hello");