A telemetry logger which can be used by extensions to log usage and error telementry.

A logger wraps around an {@link TelemetrySender sender} but it guarantees that - user settings to disable or tweak telemetry are respected, and that - potential sensitive data is removed

It also enables an "echo UI" that prints whatever data is send and it allows the editor to forward unhandled errors to the respective extensions.

To get an instance of a TelemetryLogger, use {@link env.createTelemetryLogger createTelemetryLogger}.

Variables

read onlyisErrorsEnabled:Bool

Whether or not error telemetry is enabled for this logger.

read onlyisUsageEnabled:Bool

Whether or not usage telemetry is enabled for this logger.

read onlyonDidChangeEnableStates:Event<TelemetryLogger>

An {@link Event} which fires when the enablement state of usage or error telemetry changes.

Methods

dispose():Void

Dispose this object and free resources.

logError(eventName:String, ?data:Record<String, EitherType<Any, TelemetryTrustedValue<Any>>>):Void

logError(error:Error, ?data:Record<String, EitherType<Any, TelemetryTrustedValue<Any>>>):Void

Log an error event.

After completing cleaning, telemetry setting checks, and data mix-in calls TelemetrySender.sendEventData to log the event. Differs from logUsage in that it will log the event if the telemetry setting is Error+. Automatically supports echoing to extension telemetry output channel.

Parameters:

eventName

The event name to log

data

The data to log

logUsage(eventName:String, ?data:Record<String, EitherType<Any, TelemetryTrustedValue<Any>>>):Void

Log a usage event.

After completing cleaning, telemetry setting checks, and data mix-in calls TelemetrySender.sendEventData to log the event. Automatically supports echoing to extension telemetry output channel.

Parameters:

eventName

The event name to log

data

The data to log