LoggingActivity Class

Definition

Creates Event Tracing for Windows (ETW) events that mark the start and end of a group of related events.

public ref class LoggingActivity sealed : IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingActivityFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LoggingActivity final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingActivityFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class LoggingActivity final : IClosable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingActivityFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LoggingActivity : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingActivityFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class LoggingActivity : System.IDisposable
function LoggingActivity(activityName, loggingChannel, level)
Public NotInheritable Class LoggingActivity
Implements IDisposable
Inheritance
Object Platform::Object IInspectable LoggingActivity
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Windows 10 The LoggingActivity class has been extended in the following ways:+ Now implements ILoggingTarget which provides activity start and stop methods that provide control over the format and contents of the Start and Stop events.

  • Now implements methods to log events. Events are automatically tagged with the LoggingActivity's GUID.
  • Activities can be nested. Every LoggingActivity object is attached to a LoggingChannel object. All events created by the LoggingActivity object are written through the attached LoggingChannel object.

Constructors

LoggingActivity(String, ILoggingChannel)

Initializes a new instance of the LoggingActivity class for the specified LoggingChannel in Windows 8.1 compatibility mode.

LoggingActivity(String, ILoggingChannel, LoggingLevel)

Initializes a new instance of the LoggingActivity class for the specified LoggingChannel and LoggingLevel in Windows 8.1 compatibility mode.

Properties

Channel

Returns the channel associated with this activity.

Id

Gets the identifier for the current logging activity.

Name

Gets the name of the current logging activity.

Methods

Close()

Ends the current logging activity.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

IsEnabled()

Indicates whether at least one session is listening for events from the channel associated with this activity.

IsEnabled(LoggingLevel)

Indicates whether at least one session is listening for events with the specified event severity level from the channel associated with this activity.

IsEnabled(LoggingLevel, Int64)

Indicates whether at least one session is listening for events with the specified level and keywords from the channel associated with this activity.

LogEvent(String)

Logs an event with the specified name.

LogEvent(String, LoggingFields)

Logs an event with the specified name and fields.

LogEvent(String, LoggingFields, LoggingLevel)

Logs an event with the specified name, fields, and level.

LogEvent(String, LoggingFields, LoggingLevel, LoggingOptions)

Logs an event with the specified name, fields, level, and options.

StartActivity(String)

Writes an activity start event and creates a LoggingActivity object.

StartActivity(String, LoggingFields)

Writes an activity start event with fields and creates a LoggingActivity object.

StartActivity(String, LoggingFields, LoggingLevel)

Writes an activity start event with the specified fields and level and creates a LoggingActivity object.

StartActivity(String, LoggingFields, LoggingLevel, LoggingOptions)

Writes an activity start event with the specified fields, level, and options, and creates a LoggingActivity object.

StopActivity(String)

Marks the activity as closed/disposed and generates a stop event with the specified event name.

StopActivity(String, LoggingFields)

Marks the activity as closed/disposed and generates a stop event with the specified event name and fields.

StopActivity(String, LoggingFields, LoggingOptions)

Marks the activity as closed/disposed and generates a stop event with the specified event name, fields, and options.

Applies to

See also