Table of Contents

Codeunit Telemetry

ID 8711
Namespace: System.Telemetry

A wrapper on top of Session.LogMessage that allows for having additional common custom dimensions emitted with every message.

Remarks

Every publisher needs to have an implementation of the "Telemetry Logger" interface and a subscriber to "Telemetry Loggers".OnRegisterTelemetryLogger event in one of their apps in order for this codeunit to work as expected (see "System Telemetry Logger" codeunit or example below).

Examples

codeunit 50000 "PTE Telemetry Logger" implements "Telemetry Logger" { Access = Internal;

procedure LogMessage(EventId: Text; Message: Text; Verbosity: Verbosity; DataClassification: DataClassification; TelemetryScope: TelemetryScope; CustomDimensions: Dictionary of [Text, Text]) begin Session.LogMessage(EventId, Message, Verbosity, DataClassification, TelemetryScope, CustomDimensions); end;

// For the functionality to behave as expected, there should be exactly one implementation of the "Telemetry Logger" interface registered per app publisher [EventSubscriber(ObjectType::Codeunit, Codeunit::"Telemetry Loggers", 'OnRegisterTelemetryLogger', '', true, true)] local procedure OnRegisterTelemetryLogger(var Sender: Codeunit "Telemetry Loggers") var TelemetryLogger: Codeunit "PTE Telemetry Logger"; begin Sender.Register(TelemetryLogger); end; }

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

LogMessage

Logs a telemetry message.

procedure LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope, CustomDimensions: Dictionary of [Text, Text])

Parameters

Name Type Description
EventId Text

A unique identifier of the telemetry message.

Message Text

The main content of the telemetry message (typically contains text that can be easily read by a person).

Verbosity Verbosity

The verbosity of the telemetry message.

DataClassification DataClassification

The data classification of the telemetry message.

TelemetryScope TelemetryScope

The telemetry scope of the message.

CustomDimensions Dictionary of [Text, Text]

Any additional information provided together with the telemetry message.

LogMessage

Logs a telemetry message.

procedure LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope)

Parameters

Name Type Description
EventId Text

A unique identifier of the telemetry message.

Message Text

The main content of the telemetry message (typically contains text that can be easily read by a person).

Verbosity Verbosity

The verbosity of the telemetry message.

DataClassification DataClassification

The data classification of the telemetry message.

TelemetryScope TelemetryScope

The telemetry scope of the message.

LogMessage

Logs a telemetry message.

procedure LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification)

Parameters

Name Type Description
EventId Text

A unique identifier of the telemetry message.

Message Text

The main content of the telemetry message (typically contains text that can be easily read by a person).

Verbosity Verbosity

The verbosity of the telemetry message.

DataClassification DataClassification

The data classification of the telemetry message.

See also