Logging extensions
Abstractions module provides a wide set of extensions that take care of constructing log events.
These extensions can be grouped in two ways:
By level and name: Debug, Info, Warn, Error, Fatal.
By parameters:
string:
Produces an event with given message template and no properties.
string + T:
Produces an event with given message template and properties of given object.
string + object[]:
Produces an event with given message template and given property values (names are inferred from message template).
Exception:
Produces an event with given exception and no message or properties.
Exception + string:
Produces an event with given exception and message template.
Exception + string + T:
Produces an event with given exception, message template and properties of given object.
Exception + string + object[]:
Produces an event with given exception, message template and given property values (names are inferred from message template).
interpolated string:
Produces an event with given message template and given property values (names are extracted from argument names).
Requires C# 10.
Exception + interpolated string:
Produces an event with given exception, message template and given property values (names are extracted from argument names).
Requires C# 10.
See the section about providing property values to extensions to get a grasp of how to provide values for placeholders in message template.
All extensions produce events with timestamp set to current time and level corresponding to method name.
Last updated