DebuggerLogger Class
Defines an implementation of Logger that writes to standard Debug or Trace output.
public class DebuggerLogger : Logger
Constructors
DebuggerLogger(string)
Initializes a new instance of the DebuggerLogger class.
public DebuggerLogger(string categoryName)
Parameter | Type | Description |
---|---|---|
categoryName | string | The category name of the logger, or |
Methods
BeginScope(string?, params object?[])
Begins a new scope.
public override IDisposable BeginScope(string? messageFormat, params object?[] args)
Parameter | Type | Description |
---|---|---|
messageFormat | string | |
args | object[] | The optional values to be used when formatting the scope message. |
Returns
- IDisposable:
An IDisposable that should be disposed to close the scope, or
null
if scopes are not supported by the logger.
DebugWriteLine(LogLevel, Exception?, string?)
Writes a line to debug output.
protected virtual void DebugWriteLine(LogLevel logLevel, Exception? exception, string? text)
Parameter | Type | Description |
---|---|---|
logLevel | LogLevel | The log level. |
exception | Exception | The exception, if any, associated with the message. |
text | string | The line of text to be written. |
GetLogLevelDisplayText(LogLevel)
Gets the display text for the given log level.
protected static string GetLogLevelDisplayText(LogLevel logLevel)
Parameter | Type | Description |
---|---|---|
logLevel | LogLevel | The log level. |
Returns
- string:
A string of the display text to be used for the log level.
IsEnabled(LogLevel)
Gets if the given LogLevel is currently enabled. When not enabled, messages of that level will not be written.
public override bool IsEnabled(LogLevel logLevel)
Parameter | Type | Description |
---|---|---|
logLevel | LogLevel | The LogLevel to test. |
Returns
Log(LogLevel, Func<string?>, Exception?)
Writes data to the logger with the given LogLevel.
public override void Log(LogLevel logLevel, Func<string?> messageFactory, Exception? exception)
Parameter | Type | Description |
---|---|---|
logLevel | LogLevel | The level of logging associated with the message. |
messageFactory | Func<string> | The function that is invoked to generate the message. |
exception | Exception | The Exception, if any, associated with the message. |
Inherited Members
- Logger.BeginScope()
- Logger.Log(LogLevel, string, params object[])
- Logger.Log(LogLevel, Exception, string, params object[])
- Logger.Log(LogLevel, Func<string>)
- Logger.LogCritical(Exception, string, params object[])
- Logger.LogCritical(string, params object[])
- Logger.LogCritical(Func<string>)
- Logger.LogDebug(Exception, string, params object[])
- Logger.LogDebug(string, params object[])
- Logger.LogDebug(Func<string>)
- Logger.LogError(Exception, string, params object[])
- Logger.LogError(string, params object[])
- Logger.LogError(Func<string>)
- Logger.LogInformation(Exception, string, params object[])
- Logger.LogInformation(string, params object[])
- Logger.LogInformation(Func<string>)
- Logger.LogTrace(Exception, string, params object[])
- Logger.LogTrace(string, params object[])
- Logger.LogTrace(Func<string>)
- Logger.LogWarning(Exception, string, params object[])
- Logger.LogWarning(string, params object[])
- Logger.LogWarning(Func<string>)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()