Bewerken

Delen via


EventSchemaTraceListener.TraceEvent Method

Definition

Writes event trace information to the log file.

Overloads

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

Writes trace information, a message, and event information to the log file.

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

Writes trace information, a formatted message, and event information to the log file.

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

Writes trace information, a message, and event information to the log file.

public:
 override void TraceEvent(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::String ^ message);
[System.Security.SecurityCritical]
public override void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string message);
[<System.Security.SecurityCritical>]
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string -> unit
Public Overrides Sub TraceEvent (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, message As String)

Parameters

eventCache
TraceEventCache

A TraceEventCache that contains the current process ID, thread ID, and stack trace information.

source
String

The source name.

eventType
TraceEventType

One of the TraceEventType values.

id
Int32

A numeric identifier for the event.

message
String

The message to write.

Attributes

Remarks

The eventCache, source, eventType, and id parameters are used in the header and footer of the trace. The id parameter is converted to an unsigned integer before it is written. Therefore, a negative id value is written as a large positive integer. The message parameter is written as a Data node in the EventData element.

Important

This method is not intended to be called directly by application code. It is called by methods of the Debug, Trace, and TraceSource classes to write trace data.

Applies to

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

Writes trace information, a formatted message, and event information to the log file.

public:
 override void TraceEvent(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::String ^ format, ... cli::array <System::Object ^> ^ args);
[System.Security.SecurityCritical]
public override void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object[] args);
[<System.Security.SecurityCritical>]
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string * obj[] -> unit
Public Overrides Sub TraceEvent (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, format As String, ParamArray args As Object())

Parameters

eventCache
TraceEventCache

A TraceEventCache that contains the current process ID, thread ID, and stack trace information.

source
String

The source name.

eventType
TraceEventType

One of the TraceEventType values.

id
Int32

A numeric identifier for the event.

format
String

A format string that contains zero or more format items that correspond to objects in the args array.

args
Object[]

An object array that contains zero or more objects to format.

Attributes

Remarks

The eventCache, source, eventType, and id parameters are used in the header and footer of the trace. The id parameter is converted to an unsigned integer before it is written. Therefore, a negative id value is written as a large positive integer. The String.Format(String, Object[]) method is called and the format string and args array are passed in as parameters. This method formats the args object array and writes the formatted array as the Data node in the EventData element.

Important

This method is not intended to be called directly by application code. It is called by methods of the Debug, Trace, and TraceSource classes to write trace data.

Applies to