C# Класс NLog.NLogTraceListener

TraceListener which routes all messages through NLog.
Наследование: System.Diagnostics.TraceListener
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Close ( ) : void

When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.

Fail ( string message ) : void

Emits an error message.

Fail ( string message, string detailMessage ) : void

Emits an error message and a detailed error message.

Flush ( ) : void

Flushes the output (if DisableFlush is not true) buffer with the default timeout of 15 seconds.

NLogTraceListener ( ) : System

Initializes a new instance of the NLogTraceListener class.

TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void

Writes trace information, an array of data objects and event information to the listener specific output.

TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data ) : void

Writes trace information, a data object and event information to the listener specific output.

TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void

Writes trace and event information to the listener specific output.

TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format ) : void

Writes trace information, a formatted array of objects and event information to the listener specific output.

TraceTransfer ( TraceEventCache eventCache, string source, int id, string message, Guid relatedActivityId ) : void

Writes trace information, a message, a related activity identity and event information to the listener specific output.

Write ( string message ) : void

When overridden in a derived class, writes the specified message to the listener you create in the derived class.

WriteLine ( string message ) : void

When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.

Защищенные методы

Метод Описание
GetSupportedAttributes ( ) : string[]

Gets the custom attributes supported by the trace listener.

ProcessLogEventInfo ( LogLevel logLevel, string loggerName, [ message, object arguments, int eventId, TraceEventType eventType, Guid relatedActiviyId ) : void

Process the log event The log level. The name of the logger. The log message. The log parameters. The event id. The event type. The related activity id.

Приватные методы

Метод Описание
InitAttributes ( ) : void
TranslateLogLevel ( TraceEventType eventType ) : LogLevel

Translates the event type to level from TraceEventType.

Описание методов

Close() публичный Метод

When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.
public Close ( ) : void
Результат void

Fail() публичный Метод

Emits an error message.
public Fail ( string message ) : void
message string A message to emit.
Результат void

Fail() публичный Метод

Emits an error message and a detailed error message.
public Fail ( string message, string detailMessage ) : void
message string A message to emit.
detailMessage string A detailed message to emit.
Результат void

Flush() публичный Метод

Flushes the output (if DisableFlush is not true) buffer with the default timeout of 15 seconds.
public Flush ( ) : void
Результат void

GetSupportedAttributes() защищенный Метод

Gets the custom attributes supported by the trace listener.
protected GetSupportedAttributes ( ) : string[]
Результат string[]

NLogTraceListener() публичный Метод

Initializes a new instance of the NLogTraceListener class.
public NLogTraceListener ( ) : System
Результат System

ProcessLogEventInfo() защищенный Метод

Process the log event The log level. The name of the logger. The log message. The log parameters. The event id. The event type. The related activity id.
protected ProcessLogEventInfo ( LogLevel logLevel, string loggerName, [ message, object arguments, int eventId, TraceEventType eventType, Guid relatedActiviyId ) : void
logLevel LogLevel
loggerName string
message [
arguments object
eventId int
eventType TraceEventType
relatedActiviyId Guid
Результат void

TraceData() публичный Метод

Writes trace information, an array of data objects and event information to the listener specific output.
public TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void
eventCache TraceEventCache A object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
Результат void

TraceData() публичный Метод

Writes trace information, a data object and event information to the listener specific output.
public TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data ) : void
eventCache TraceEventCache A object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
data object The trace data to emit.
Результат void

TraceEvent() публичный Метод

Writes trace and event information to the listener specific output.
public TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void
eventCache TraceEventCache A object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
Результат void

TraceEvent() публичный Метод

Writes trace information, a formatted array of objects and event information to the listener specific output.
public TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format ) : void
eventCache TraceEventCache A object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
format string A format string that contains zero or more format items, which correspond to objects in the array.
Результат void

TraceTransfer() публичный Метод

Writes trace information, a message, a related activity identity and event information to the listener specific output.
public TraceTransfer ( TraceEventCache eventCache, string source, int id, string message, Guid relatedActivityId ) : void
eventCache TraceEventCache A object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
id int A numeric identifier for the event.
message string A message to write.
relatedActivityId Guid A object identifying a related activity.
Результат void

Write() публичный Метод

When overridden in a derived class, writes the specified message to the listener you create in the derived class.
public Write ( string message ) : void
message string A message to write.
Результат void

WriteLine() публичный Метод

When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.
public WriteLine ( string message ) : void
message string A message to write.
Результат void