Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LoggingActivity class

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

Syntax


var loggingActivity = new Windows.Foundation.Diagnostics.LoggingActivity(string, iLoggingChannel);
var loggingActivity = new Windows.Foundation.Diagnostics.LoggingActivity(string, iLoggingChannel, loggingLevel);

Members

The LoggingActivity class has these types of members:

Constructors

The LoggingActivity class has these constructors.

ConstructorDescription
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.

 

Methods

The LoggingActivity class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Close Ends the current logging activity.
Dispose Performs 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.

 

Properties

The LoggingActivity class has these properties.

PropertyAccess typeDescription

Channel

Read-only

Returns the channel associated with this activity.

Id

Read-only

Gets the identifier for the current logging activity.

Name

Read-only

Gets the name of the current logging activity.

 

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.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Foundation.Diagnostics
Windows::Foundation::Diagnostics [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1 [Windows Store apps only]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Foundation.Diagnostics
Windows::Foundation::Diagnostics [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06030000)]

See also

Object
IClosable
LoggingChannel
ILoggingTarget
Logging sample (Windows 10)

 

 

Show: