// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; using Microsoft.PowerToys.Telemetry.Events; namespace Microsoft.PowerToys.Telemetry { /// /// Telemetry helper class for PowerToys. /// public class PowerToysTelemetry : TelemetryBase { /// /// Name for ETW event. /// private const string EventSourceName = "Microsoft.PowerToys"; /// /// Initializes a new instance of the class. /// public PowerToysTelemetry() : base(EventSourceName) { } /// /// Gets an instance of the class. /// public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry(); /// /// Publishes ETW event when an action is triggered on /// public void WriteEvent(T telemetryEvent) where T : EventBase, IEvent { this.Write( null, new EventSourceOptions() { Keywords = ProjectKeywordMeasure, Tags = ProjectTelemetryTagProductAndServicePerformance, }, telemetryEvent); } } }