Console logger supports scopes in rc1
parent
ff52b01882
commit
0ca4ed005a
|
@ -119,7 +119,7 @@ The console logger prefixes verbose output with "verbose: " and uses a gray font
|
|||
Scopes
|
||||
^^^^^^
|
||||
|
||||
In the course of logging information within your application, you can group a set of logical operations within a *scope*. A scope is an ``IDisposable`` type returned by calling the ``BeginScopeImpl`` method, which lasts from the moment it is created until it is disposed. Not all loggers support scopes. For example, the `ConsoleLogger simply returns null <https://github.com/aspnet/Logging/blob/1.0.0-rc1/src/Microsoft.Extensions.Logging.Console/ConsoleLogger.cs#L114>`_ from ``BeginScopeImpl``. The built-in `TraceSource logger <https://github.com/aspnet/Logging/blob/1.0.0-rc1/src/Microsoft.Extensions.Logging.TraceSource/TraceSourceLogger.cs#L66-L69>`_ returns a scope instance that is responsible for starting and stopping tracing operations. Any logging state, such as a transaction id, is attached to the scope when it is created.
|
||||
In the course of logging information within your application, you can group a set of logical operations within a *scope*. A scope is an ``IDisposable`` type returned by calling the ``BeginScopeImpl`` method, which lasts from the moment it is created until it is disposed. The built-in `TraceSource logger <https://github.com/aspnet/Logging/blob/1.0.0-rc1/src/Microsoft.Extensions.Logging.TraceSource/TraceSourceLogger.cs#L66-L69>`_ returns a scope instance that is responsible for starting and stopping tracing operations. Any logging state, such as a transaction id, is attached to the scope when it is created.
|
||||
|
||||
Scopes are not required, and should be used sparingly, if at all. They're best used for operations that have a distinct beginning and end, such as a transaction involving multiple resources.
|
||||
|
||||
|
|
Loading…
Reference in New Issue