Interface ILoggerWrapper<T>
- Namespace
- Arc4u.Diagnostics
- Assembly
- Arc4u.Diagnostics.dll
An ILogger<TCategoryName> that lets callers attach extra properties (see LoggerWrapperExtensions) and a message category to the log entry before it is written.
public interface ILoggerWrapper<T> : ILogger<T>, ILogger, ILoggerCallerMember
Type Parameters
TThe category type of the logger.
- Inherited Members
- Extension Methods
Properties
AdditionalFields
Gets the additional properties that are written with the next log entry of this logger.
Dictionary<string, object?> AdditionalFields { get; }
Property Value
Remarks
The properties are cleared once the entry is written.
IncludeStackTrace
Sets a value indicating whether the stack trace is added to the next log entry; reset once the entry is written.
bool IncludeStackTrace { set; }
Property Value
Methods
SetContext(string, string, Type?)
Returns a logger that writes its entries with the category, the calling member and optionally the source context type given.
ILoggerWrapper<T> SetContext(string category, string caller = "", Type? realType = null)
Parameters
categorystringThe message category, see MessageCategory.
callerstringThe name of the calling member.
realTypeTypeThe type to report as the source context instead of
T, or null to keepT.
Returns
- ILoggerWrapper<T>
The logger wrapper to use for the entry.
Remarks
The returned logger has its own additional fields, so a logger shared between callers (or threads) is never modified by an entry being prepared.