Skip to content

TraceLogSource Class

A source that routes all logs from the inbuilt .NET Trace API to the BepInEx logging system.

C#
public class TraceLogSource : TraceListener, IDisposable

Inheritance objectMarshalByRefObjectTraceListener

Implements IDisposable

Creates a new trace log source.

C#
protected TraceLogSource()

Whether Trace logs are currently being rerouted.

C#
public static bool IsListening { get; }

Internal log source.

C#
protected ManualLogSource LogSource { get; }

Creates a new trace log source.

C#
public static ILogSource CreateSource()

ILogSource
New log source (or already existing one).

Writes a message to the underlying ManualLogSource instance.

C#
public override void Write(string message)

message string
The message to write.

Writes a message and a newline to the underlying ManualLogSource instance.

C#
public override void WriteLine(string message)

message string
The message to write.

TraceEvent(TraceEventCache, string, TraceEventType, int, string, params object[])

Section titled “TraceEvent(TraceEventCache, string, TraceEventType, int, string, params object[])”

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

C#
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args)

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 args array.

args object[]
An object array containing zero or more objects to format.

TraceEvent(TraceEventCache, string, TraceEventType, int, string)

Section titled “TraceEvent(TraceEventCache, string, TraceEventType, int, string)”

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

C#
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)

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.

message string
A message to write.