Table of Contents

Class NLogWrapper

Namespace
Loehnert.Lisrt.Messaging
Assembly
Loehnert.Lisrt.dll

Wraps the NLog.Logger to a ILogger.

public class NLogWrapper : ILogger
Inheritance
NLogWrapper
Implements
Inherited Members

Constructors

NLogWrapper(string)

Initializes a new instance of the NLogWrapper class.

public NLogWrapper(string name)

Parameters

name string

Name of the logger.

Fields

NLogConfigurationFileName

Gets the name for the NLog configuration file ('NLog.config').

public static readonly string NLogConfigurationFileName

Field Value

string

Properties

Name

Gets the name of the logger.

public string Name { get; }

Property Value

string

Methods

IsEnabled(LogLevel)

Returns a value whether indicating logLevel is enabled.

public bool IsEnabled(LogLevel logLevel)

Parameters

logLevel LogLevel

Selected log level.

Returns

bool

A value whether indicating logLevel is enabled.

Log(LogLevel, string, ILisrtModule)

Logs text with LogLevel.

public void Log(LogLevel loglevel, string message, ILisrtModule module = null)

Parameters

loglevel LogLevel

Level for the log.

message string

Message to log.

module ILisrtModule

Module where the log comes from (default = null).

LogCommunication(string, TransmissionDirection, string, string)

Logs a Communication log.

public void LogCommunication(string moduleName, TransmissionDirection direction, string data, string comment = "")

Parameters

moduleName string

The full name of ILisrtModule.

direction TransmissionDirection

The transmission direction.

data string

The communication data.

comment string

Some comment for the sent/received data.

LogMessage(IMessage)

Logs a message.

public void LogMessage(IMessage message)

Parameters

message IMessage

Message to be logged.

LogMessage(IMessage, StackTrace)

Logs a message.

public void LogMessage(IMessage message, StackTrace stackTrace)

Parameters

message IMessage

IMessage to be logged. When null then a ArgumentNullException is logged.

stackTrace StackTrace

For adding the correct class- and method-name to the log. If it's null, the correct name is not guaranteed.