Skip to content

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

View source

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

NameSummary
.ctorInitializes a new instance of the [NLogLogger](# class.

Properties

NameSummary
LevelGets the level at which the target will emit messages.
IsDebugEnabledGets a value indicating whether the logger currently emits debug logs.
IsInfoEnabledGets a value indicating whether the logger currently emits information logs.
IsWarnEnabledGets a value indicating whether the logger currently emits warning logs.
IsErrorEnabledGets a value indicating whether the logger currently emits error logs.
IsFatalEnabledGets a value indicating whether the logger currently emits fatal logs.

Methods

NameSummary
Dispose
WriteWrites a message to the target.
DebugEmits a debug log message. This will emit the public contents of the object provided to the log.
DebugExceptionEmits a debug log message. This will emit details about a exception. This type of logging is not able to be localized.
InfoEmits a info log message. This will emit the public contents of the object provided to the log.
InfoExceptionEmits a info log message. This will emit details about a exception. This type of logging is not able to be localized.
WarnEmits a warning log message. This will emit the public contents of the object provided to the log.
WarnExceptionEmits a warning log message. This will emit details about a exception. This type of logging is not able to be localized.
ErrorEmits a error log message. This will emit the public contents of the object provided to the log.
ErrorExceptionEmits a error log message. This will emit details about a exception. This type of logging is not able to be localized.
FatalEmits a fatal log message. This will emit the public contents of the object provided to the log.
FatalExceptionEmits a fatal log message. This will emit details about a exception. This type of logging is not able to be localized.
Inherited members