BeginScope Method
BeginScope(Logger, string, params object?[])
Formats the message and creates a scope.
C#
[Obsolete("Obsolete, use equivalent ILogger method, or view the changelog for further instruction.")]
public static IDisposable? BeginScope(this Logger logger, string messageFormat, params object?[] args)
Parameters
Type | Name | Description |
---|---|---|
Logger | logger | The Logger to create the scope in. |
string | messageFormat | Format string of the log message in message template format.
Example: |
object[] | args | An object array that contains zero or more objects to format. |
Returns
IDisposable
A disposable scope object. Can be null.
Examples
using(logger.BeginScope("Processing request from {Address}", address)) { }