From 17fc3a36f4218a7b45c32f48104a543e5382c903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 3 Apr 2024 21:23:36 +0200 Subject: [PATCH] otelslog: Add example (#5355) --- bridges/otelslog/exampe_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 bridges/otelslog/exampe_test.go diff --git a/bridges/otelslog/exampe_test.go b/bridges/otelslog/exampe_test.go new file mode 100644 index 00000000000..b260ee3b168 --- /dev/null +++ b/bridges/otelslog/exampe_test.go @@ -0,0 +1,17 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelslog_test + +import ( + "go.opentelemetry.io/contrib/bridges/otelslog" + "go.opentelemetry.io/otel/log/noop" +) + +func Example() { + // Use a working LoggerProvider implementation instead e.g. using go.opentelemetry.io/otel/sdk/log. + provider := noop.NewLoggerProvider() + + // Create an *slog.Logger and use it in your application. + otelslog.NewLogger(otelslog.WithLoggerProvider(provider)) +}