Skip to content

Commit

Permalink
otelslog: Add example (#5355)
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Apr 3, 2024
1 parent d15fe4f commit 17fc3a3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bridges/otelslog/exampe_test.go
Original file line number Diff line number Diff line change
@@ -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))
}

0 comments on commit 17fc3a3

Please sign in to comment.