Skip to content

Commit

Permalink
Add TestNewLoggerConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Dec 27, 2023
1 parent 5f5c068 commit 7c72b03
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions log/provider_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package log_test

import (
"testing"

"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/log"
)

func TestNewLoggerConfig(t *testing.T) {
version := "v1.1.1"
schemaURL := "https://opentelemetry.io/schemas/1.0.0"
attr := attribute.NewSet(
attribute.String("user", "alice"),
attribute.Bool("admin", true),
)

c := log.NewLoggerConfig(
log.WithInstrumentationVersion(version),
log.WithSchemaURL(schemaURL),
log.WithInstrumentationAttributes(attr.ToSlice()...),
)

assert.Equal(t, version, c.InstrumentationVersion(), "instrumentation version")
assert.Equal(t, schemaURL, c.SchemaURL(), "schema URL")
assert.Equal(t, attr, c.InstrumentationAttributes(), "instrumentation attributes")
}

0 comments on commit 7c72b03

Please sign in to comment.