LAUREL BRIDGE

NLogLogAdapter Class

DICOM Connectivity Framework V3.4
Adapter class to demonstrate using NLog as the back end log facility.
Inheritance Hierarchy

SystemObject
  LaurelBridge.DCF.Examples.NLogAdapterNLogLogAdapter

Namespace:  LaurelBridge.DCF.Examples.NLogAdapter
Assembly:  ExampleNLogAdapter (in ExampleNLogAdapter.dll) Version: DCF34 r11232 DCF_3_4_20
Syntax

C#
public sealed class NLogLogAdapter : IDisposable

The NLogLogAdapter type exposes the following members.

Constructors

  NameDescription
Public methodNLogLogAdapter
Constructor that configures NLog using the input path to the desired nlog configuration xml file.
Top
Properties

  NameDescription
Public propertyFormatProvider
Get/Set the format provider to use when logging messages to nlog.
Top
Methods

  NameDescription
Public methodDebug
Log a debug level message to the logging backend.
Public methodDebugFormat
Log a debug level message to the logging backend.
Public methodDispose
Flush any pending buffered log messages and cleanup logger resources.
Public methodError
Log an error level message to the logging backend.
Public methodErrorFormat
Log an error level message to the logging backend.
Public methodFatal
Log a fatal level message to the logging backend.
Public methodFatalFormat
Log a fatal level message to the logging backend.
Public methodFlush
Flush any pending buffered log messages. The implementation of this method is defined by the LogAdapter.
Public methodInfo
Log an info level message to the logging backend.
Public methodInfoFormat
Log an info level message to the logging backend.
Public methodReconfigureLogDirectory
Reconfigures the output log directory for the file logger.
Public methodVerbose
Log a verbose level message to the logging backend.
Public methodVerboseFormat
Log a verbose level message to the logging backend.
Public methodWarn
Log a warn level message to the logging backend.
Public methodWarnFormat
Log a warn level message to the logging backend.
Top
Remarks

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 libary.

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.1.2.

See Also

Reference