NLogLogger class¶
Attributes: [DebuggerDisplay("Name={_logger.Name} Level={Level}")]
Defined in
Namespace: Splat.NLog
Assembly: Splat.NLog.dll
Full name: Splat.NLog.NLogLogger
Modifiers: public sealed
Summary¶
Contains the allocation-free, strongly-typed logging overloads that accept a message format and typed arguments.
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471
Class hierarchy
classDiagram
class NLogLogger
class IFullLogger {
<>
}
IFullLogger <|.. NLogLogger
class IAllocationFreeLogger {
<>
}
IAllocationFreeLogger <|.. NLogLogger
class IAllocationFreeErrorLogger {
<>
}
IAllocationFreeErrorLogger <|.. NLogLogger
class ILogger {
<>
}
ILogger <|.. NLogLogger
class IDisposable {
<>
}
IDisposable <|.. NLogLogger
Implements: IFullLogger, IAllocationFreeLogger, IAllocationFreeErrorLogger, ILogger, IDisposable
Remarks¶
This class acts as an adapter, allowing code that depends on IFullLogger to log messages through NLog. It supports all standard log levels and message formats, and automatically tracks changes to the underlying NLog logger's configuration. Instances of NLogLogger are not thread-affine and can be used concurrently from multiple threads. Disposing the logger detaches internal event handlers but does not dispose the underlying NLog logger.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [NLogLogger](# class. |
Properties¶
| Name | Summary |
|---|---|
| Level | Gets the level at which the target will emit messages. |
| IsDebugEnabled | Gets a value indicating whether the logger currently emits debug logs. |
| IsInfoEnabled | Gets a value indicating whether the logger currently emits information logs. |
| IsWarnEnabled | Gets a value indicating whether the logger currently emits warning logs. |
| IsErrorEnabled | Gets a value indicating whether the logger currently emits error logs. |
| IsFatalEnabled | Gets a value indicating whether the logger currently emits fatal logs. |
Methods¶
| Name | Summary |
|---|---|
| Dispose | |
| Write | Writes a message to the target. |
| Debug | Emits a debug log message. This will emit the public contents of the object provided to the log. |
| DebugException | Emits a debug log message. This will emit details about a exception. This type of logging is not able to be localized. |
| Info | Emits a info log message. This will emit the public contents of the object provided to the log. |
| InfoException | Emits a info log message. This will emit details about a exception. This type of logging is not able to be localized. |
| Warn | Emits a warning log message. This will emit the public contents of the object provided to the log. |
| WarnException | Emits a warning log message. This will emit details about a exception. This type of logging is not able to be localized. |
| Error | Emits a error log message. This will emit the public contents of the object provided to the log. |
| ErrorException | Emits a error log message. This will emit details about a exception. This type of logging is not able to be localized. |
| Fatal | Emits a fatal log message. This will emit the public contents of the object provided to the log. |
| FatalException | Emits a fatal log message. This will emit details about a exception. This type of logging is not able to be localized. |