C# Class NLog.NLogTraceListener

TraceListener which routes all messages through NLog.
Inheritance: System.Diagnostics.TraceListener
Afficher le fichier Open project: NLog/NLog Class Usage Examples

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
InitAttributes ( ) : void
TranslateLogLevel ( TraceEventType eventType ) : LogLevel

Translates the event type to level from TraceEventType.

Method Details

Close() public méthode

When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.
public Close ( ) : void
Résultat void

Fail() public méthode

Emits an error message.
public Fail ( string message ) : void
message string A message to emit.
Résultat void

Fail() public méthode

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.
Résultat void

Flush() public méthode

Flushes the output (if DisableFlush is not true) buffer with the default timeout of 15 seconds.
public Flush ( ) : void
Résultat void

GetSupportedAttributes() protected méthode

Gets the custom attributes supported by the trace listener.
protected GetSupportedAttributes ( ) : string[]
Résultat string[]

NLogTraceListener() public méthode

Initializes a new instance of the NLogTraceListener class.
public NLogTraceListener ( ) : System
Résultat System

ProcessLogEventInfo() protected méthode

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
Résultat void

TraceData() public méthode

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.
Résultat void

TraceData() public méthode

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.
Résultat void

TraceEvent() public méthode

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.
Résultat void

TraceEvent() public méthode

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.
Résultat void

TraceTransfer() public méthode

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.
Résultat void

Write() public méthode

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.
Résultat void

WriteLine() public méthode

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.
Résultat void