From 136595c6bd1a0ae7964e42841178e725586aa567 Mon Sep 17 00:00:00 2001 From: "Haoran Sun (Business Central)" Date: Fri, 13 Sep 2024 10:12:15 +0200 Subject: [PATCH] add Telemetry logger for Copilot toolkit --- .../Common/CopilotTelemetryLogger.Codeunit.al | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 samples/AzureOpenAI/Advanced_SuggestJob/Common/CopilotTelemetryLogger.Codeunit.al diff --git a/samples/AzureOpenAI/Advanced_SuggestJob/Common/CopilotTelemetryLogger.Codeunit.al b/samples/AzureOpenAI/Advanced_SuggestJob/Common/CopilotTelemetryLogger.Codeunit.al new file mode 100644 index 00000000..1656e550 --- /dev/null +++ b/samples/AzureOpenAI/Advanced_SuggestJob/Common/CopilotTelemetryLogger.Codeunit.al @@ -0,0 +1,18 @@ +codeunit 54300 "Copilot Telemetry Logger" implements "Telemetry Logger" +{ + InherentEntitlements = X; + InherentPermissions = X; + + 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; + + [EventSubscriber(ObjectType::Codeunit, Codeunit::"Telemetry Loggers", OnRegisterTelemetryLogger, '', true, true)] + local procedure OnRegisterTelemetryLogger(var Sender: Codeunit "Telemetry Loggers") + var + CopilotTelemetryLogger: Codeunit "Copilot Telemetry Logger"; + begin + Sender.Register(CopilotTelemetryLogger); + end; +} \ No newline at end of file