Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Diagnostics.​Tracing.​EventSource

Assembly: System.Diagnostics.Tracing

Inheritance: object → EventSource

Provides the ability to create events for event tracing across platforms.

Properties

public Exception
ConstructionException
Gets any exception that was thrown during the construction of the event source.
public Guid
Guid
The unique identifier for the event source.
public string
Name
The friendly name of the class that is derived from the event source.
Settings
Gets the settings applied to this event source.

Methods

public void
Dispose​()
Releases all resources used by the current instance of the <see cref="T:System.Diagnostics.Tracing.EventSource" /> class.
protected void
Dispose​(bool disposing)
disposing <see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
Releases the unmanaged resources used by the <see cref="T:System.Diagnostics.Tracing.EventSource" /> class and optionally releases the managed resources.
protected void
Finalize​()
Allows the <see cref="T:System.Diagnostics.Tracing.EventSource" /> object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.
public string
GetTrait​(string key)
key The key of the trait to get.
Returns The trait value associated with the specified key. If the key is not found, returns <see langword="null" /> .
Gets the trait value associated with the specified key.
public bool
IsEnabled​()
Returns <see langword="true" /> if the current event source is enabled; otherwise, <see langword="false" /> .
Determines whether the current event source is enabled.
public bool
IsEnabled​(EventLevel level, EventKeywords keywords)
level The level of the event source.
keywords The keyword of the event source.
Returns <see langword="true" /> if the event source is enabled; otherwise, <see langword="false" /> .
Determines whether the current event source that has the specified level and keyword is enabled.
public bool
IsEnabled​(EventLevel level, EventKeywords keywords, EventChannel channel)
level The event level to check. An event source will be considered enabled when its level is greater than or equal to <paramref name="level" /> .
keywords The event keywords to check.
channel The event channel to check.
Returns <see langword="true" /> if the event source is enabled for the specified event level, keywords and channel; otherwise, <see langword="false" /> . The result of this method is only an approximation of whether a particular event is active. Use it to avoid expensive computation for logging when logging is disabled. Event sources may have additional filtering that determines their activity.
Determines whether the current event source is enabled for events with the specified level, keywords and channel.
protected void
OnEventCommand​(EventCommandEventArgs command)
command The arguments for the event.
Called when the current event source is updated by the controller.
public string
ToString​()
Returns The name and unique identifier that identify the current event source.
Obtains a string representation of the current event source instance.
public void
Write​(string eventName)
eventName The name of the event to write.
Writes an event without fields, but with the specified name and default options.
public void
Write​(string eventName, EventSourceOptions options)
eventName The name of the event to write.
options The options such as level, keywords and operation code for the event.
Writes an event without fields, but with the specified name and options.
protected void
WriteEvent​(int eventId)
eventId The event identifier. This value should be between 0 and 65535.
Writes an event by using the provided event identifier.
protected void
WriteEvent​(int eventId, byte[] arg1)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A byte array argument.
Writes an event by using the provided event identifier and byte array argument.
protected void
WriteEvent​(int eventId, int arg1)
eventId The event identifier. This value should be between 0 and 65535.
arg1 An integer argument.
Writes an event by using the provided event identifier and 32-bit integer argument.
protected void
WriteEvent​(int eventId, int arg1, int arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 An integer argument.
arg2 An integer argument.
Writes an event by using the provided event identifier and 32-bit integer arguments.
protected void
WriteEvent​(int eventId, int arg1, int arg2, int arg3)
eventId The event identifier. This value should be between 0 and 65535.
arg1 An integer argument.
arg2 An integer argument.
arg3 An integer argument.
Writes an event by using the provided event identifier and 32-bit integer arguments.
protected void
WriteEvent​(int eventId, int arg1, string arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 32-bit integer argument.
arg2 A string argument.
Writes an event by using the provided event identifier and 32-bit integer and string arguments.
protected void
WriteEvent​(int eventId, long arg1)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 64 bit integer argument.
Writes an event by using the provided event identifier and 64-bit integer argument.
protected void
WriteEvent​(int eventId, long arg1, byte[] arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 64-bit integer argument.
arg2 A byte array argument.
Writes the event data using the specified identifier and 64-bit integer and byte array arguments.
protected void
WriteEvent​(int eventId, long arg1, long arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 64 bit integer argument.
arg2 A 64 bit integer argument.
Writes an event by using the provided event identifier and 64-bit arguments.
protected void
WriteEvent​(int eventId, long arg1, long arg2, long arg3)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 64 bit integer argument.
arg2 A 64 bit integer argument.
arg3 A 64 bit integer argument.
Writes an event by using the provided event identifier and 64-bit arguments.
protected void
WriteEvent​(int eventId, long arg1, string arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A 64-bit integer argument.
arg2 A string argument.
Writes an event by using the provided event identifier and 64-bit integer, and string arguments.
protected void
WriteEvent​(int eventId, EventSourcePrimitive[] args)
protected void
WriteEvent​(int eventId, object[] args)
eventId The event identifier. This value should be between 0 and 65535.
args An array of objects.
Writes an event by using the provided event identifier and array of arguments.
protected void
WriteEvent​(int eventId, string arg1)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
Writes an event by using the provided event identifier and string argument.
protected void
WriteEvent​(int eventId, string arg1, int arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
arg2 A 32 bit integer argument.
Writes an event by using the provided event identifier and arguments.
protected void
WriteEvent​(int eventId, string arg1, int arg2, int arg3)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
arg2 A 32 bit integer argument.
arg3 A 32 bit integer argument.
Writes an event by using the provided event identifier and arguments.
protected void
WriteEvent​(int eventId, string arg1, long arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
arg2 A 64 bit integer argument.
Writes an event by using the provided event identifier and arguments.
protected void
WriteEvent​(int eventId, string arg1, string arg2)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
arg2 A string argument.
Writes an event by using the provided event identifier and string arguments.
protected void
WriteEvent​(int eventId, string arg1, string arg2, string arg3)
eventId The event identifier. This value should be between 0 and 65535.
arg1 A string argument.
arg2 A string argument.
arg3 A string argument.
Writes an event by using the provided event identifier and string arguments.
protected void
WriteEventCore​(int eventId, int eventDataCount, EventData* data)
protected void
WriteEventWithRelatedActivityId​(int eventId, Guid relatedActivityId, object[] args)
eventId An identifier that uniquely identifies this event within the <see cref="T:System.Diagnostics.Tracing.EventSource" /> .
relatedActivityId The related activity identifier.
args An array of objects that contain data about the event.
Writes an event that indicates that the current activity is related to another activity.
protected void
WriteEventWithRelatedActivityIdCore​(int eventId, Guid* relatedActivityId, int eventDataCount, EventData* data)
public void
Write​(string eventName, EventSourceOptions options, T data)
public void
Write​(string eventName, EventSourceOptions& options, Guid& activityId, Guid& relatedActivityId, T& data)
public void
Write​(string eventName, EventSourceOptions& options, T& data)
public void
Write​(string eventName, T data)
public bool
Equals​(object obj)
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object