XmlWriterTraceListener.TraceTransfer(TraceEventCache, String, Int32, String, Guid) 方法
定义
将跟踪信息(包括相关活动的标识)、消息和事件信息写入文件或流中。Writes trace information including the identity of a related activity, a message, and event information to the file or stream.
public:
override void TraceTransfer(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, int id, System::String ^ message, Guid relatedActivityId);
public override void TraceTransfer (System.Diagnostics.TraceEventCache? eventCache, string source, int id, string? message, Guid relatedActivityId);
public override void TraceTransfer (System.Diagnostics.TraceEventCache eventCache, string source, int id, string message, Guid relatedActivityId);
override this.TraceTransfer : System.Diagnostics.TraceEventCache * string * int * string * Guid -> unit
Public Overrides Sub TraceTransfer (eventCache As TraceEventCache, source As String, id As Integer, message As String, relatedActivityId As Guid)
参数
- eventCache
- TraceEventCache
包含当前进程 ID、线程 ID 以及堆栈跟踪信息的 TraceEventCache。A TraceEventCache that contains the current process ID, thread ID, and stack trace information.
- source
- String
源名称。The source name.
- id
- Int32
事件的数值标识符。A numeric identifier for the event.
- message
- String
要写入的跟踪消息。A trace message to write.
注解
TraceTransfer方法用于关联相关跟踪。The TraceTransfer method is used for the correlation of related traces. eventCache、、 source id 和 relatedActivityId 参数在跟踪的页眉和页脚中使用。The eventCache, source, id, and relatedActivityId parameters are used in the header and footer of the trace. 在 id 写入之前,将参数转换为无符号整数,因此负值 id 将被写入为大正整数。The id parameter is converted to an unsigned integer before writing, so a negative id value is written as a large positive integer. message参数作为 Message 元素写入。The message parameter is written as the Message element. Guid.ToString(String)调用方法将 relatedActivityId 值转换为标头中显示的 "B" 格式字符串。The Guid.ToString(String) method is called to convert the relatedActivityIdvalue to a "B" formatted string, which appears in the header. SubTypeName页脚中的元素将跟踪事件类型标识为 Transfer 。The SubTypeName element in the footer identifies the trace event type as a Transfer.
重要
TraceTransfer方法不应由应用程序代码调用。The TraceTransfer method is not intended to be called by application code. 它旨在由 TraceSource 对象调用,以便为其方法发出跟踪信息 TraceTransfer 。It is intended to be called by a TraceSource object to emit the trace information for its TraceTransfer method.