ConsoleLog
A log which outputs events to console.
SetUp
Include Logging.Console
library in project:
An standard ILog
is created using ConsoleLog
:
Create an event. Let it be an error message:
You can add as many events as you want:
To observe the result, add ConsoleLog.Flush()
or ConsoleLog.FlushAsync()
.
Result:
First Usage
Configure a log and use ConsoleLogSettings
for it.
For example, you can change output template. The log would show only time stamp and message. Leave the rest of the code the same:
Result:
Configurations
Console log's configuration passes in code (the example above).
Settings
This parameters are adjusted in ConsoleLogSettings
:
Parameters
Description
If specified, this IFormatProvider will be used when formatting log events.
Mapping of log levels to text color in console
Specifies whether the console log must colorize text depending on the log level
Last updated