Skip to main content

Interface: TelemetryLogger

Defined in: packages/extension-api/src/extension-api.d.ts:4416

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

A logger wraps around an 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 `createTelemetryLogger`.

Properties

isErrorsEnabled

readonly isErrorsEnabled: boolean

Defined in: packages/extension-api/src/extension-api.d.ts:4430

Whether or not error telemetry is enabled for this logger.


isUsageEnabled

readonly isUsageEnabled: boolean

Defined in: packages/extension-api/src/extension-api.d.ts:4425

Whether or not usage telemetry is enabled for this logger.


onDidChangeEnableStates

readonly onDidChangeEnableStates: Event<TelemetryLogger>

Defined in: packages/extension-api/src/extension-api.d.ts:4420

An Event which fires when the enablement state of usage or error telemetry changes.

Methods

dispose()

dispose(): void

Defined in: packages/extension-api/src/extension-api.d.ts:4465

Dispose this object and free resources.

Returns

void


logError()

Call Signature

logError(eventName, data?): void

Defined in: packages/extension-api/src/extension-api.d.ts:4452

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

string

The event name to log

data?

Record<string, any>

The data to log

Returns

void

Call Signature

logError(error, data?): void

Defined in: packages/extension-api/src/extension-api.d.ts:4460

Log an error event.

Parameters
error

Error

The error object which contains the stack trace cleaned of PII

data?

Record<string, any>

Additional data to log alongside the stack trace

Returns

void


logUsage()

logUsage(eventName, data?): void

Defined in: packages/extension-api/src/extension-api.d.ts:4441

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

string

The event name to log

data?

Record<string, any>

The data to log

Returns

void