LaurelBridge.DCFExamples.NLogAdapterNLogLogAdapter
Namespace: LaurelBridge.DCFExamples.NLogAdapter
Assembly: ExampleNLogAdapter (in ExampleNLogAdapter.dll) Version: DCF34 r13043 DCF_3_4_56_20220408 NetFramework
public sealed class NLogLogAdapter : IDisposable
The NLogLogAdapter type exposes the following members.
Name | Description | |
---|---|---|
NLogLogAdapter |
Constructor that configures NLog using the input path to the desired nlog configuration xml file.
|
Name | Description | |
---|---|---|
FormatProvider |
Get/Set the format provider to use when logging messages to nlog.
|
Name | Description | |
---|---|---|
Debug |
Log a debug level message to the logging backend.
| |
DebugFormat |
Log a debug level message to the logging backend.
| |
Dispose |
Flush any pending buffered log messages and cleanup logger resources.
| |
Error |
Log an error level message to the logging backend.
| |
ErrorFormat |
Log an error level message to the logging backend.
| |
Fatal |
Log a fatal level message to the logging backend.
| |
FatalFormat |
Log a fatal level message to the logging backend.
| |
Flush |
Flush any pending buffered log messages. The implementation of this method is defined by the LogAdapter.
| |
GetNLogLogDirectoryPath |
Get the file name associated with a logging target name. Dig through any
wrapper filters until we get to a file target and return the directory name.
| |
Info |
Log an info level message to the logging backend.
| |
InfoFormat |
Log an info level message to the logging backend.
| |
ReconfigureLogDirectory |
Reconfigures the output log directory for the file logger.
| |
Verbose |
Log a verbose level message to the logging backend.
| |
VerboseFormat |
Log a verbose level message to the logging backend.
| |
Warn |
Log a warn level message to the logging backend.
| |
WarnFormat |
Log a warn level message to the logging backend.
|
The logging configuration is read from an NLog xml configuration file in the adapter constructor. This adapter creates a single NLog.Logger for all log messages from the DCF library.
Each DCF ILogger call passes a LogEvent that contains the log message, arguments, exception, and session information. This adapter takes the information in the DCF LogEvent and converts it to an NLog LogEventInfo. This allows the properties in the DCF LogEvent to be accessible as variables the NLog configuration.
The NLog binaries for this example were downloaded from: http://nlog-project.org.
This adapter class was written using NLog v4.5.11.