Logging extensions
Last updated
Last updated
provides a wide set of extensions that take care of constructing .
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 and no properties.
string + T:
Produces an event with given and properties of given object.
string + object[]:
Produces an event with given 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 .
Exception + string + T:
Produces an event with given exception, and properties of given object.
Exception + string + object[]:
Produces an event with given exception, and given property values (names are inferred from message template).
interpolated string:
Produces an event with given and given property values (names are extracted from argument names).
C# 10.
Exception + interpolated string:
Produces an event with given exception, and given property values (names are extracted from argument names).
C# 10.
All extensions produce events with timestamp set to current time and level corresponding to method name.
See the section about to extensions to get a grasp of how to provide values for placeholders in message template.