Skip to content

Commit

Permalink
running precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugoro1 committed Jun 17, 2024
1 parent dd9d638 commit 8dc0545
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
1 change: 0 additions & 1 deletion instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ var errUndefinedTarget = fmt.Errorf("undefined target Go binary, consider settin

func newLogger(logLevel internalLog.Level) logr.Logger {
level, err := zap.ParseAtomicLevel(logLevel.String())

if err != nil {
level, _ = zap.ParseAtomicLevel(internalLog.LevelInfo.String())
}
Expand Down
3 changes: 2 additions & 1 deletion instrumentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/auto/internal/pkg/log"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"

"go.opentelemetry.io/auto/internal/pkg/log"
)

func TestWithServiceName(t *testing.T) {
Expand Down
33 changes: 27 additions & 6 deletions internal/pkg/log/level.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package log

import (
Expand All @@ -9,13 +23,20 @@ import (
type Level string

const (
LevelDebug Level = "debug"
LevelInfo Level = "info"
LevelWarn Level = "warn"
LevelError Level = "error"
// Log Level [debug].
LevelDebug Level = "debug"
// Log Level [info].
LevelInfo Level = "info"
// Log Level [warn].
LevelWarn Level = "warn"
// Log Level [error].
LevelError Level = "error"
// Log Level [dpanic].
LevelDPanic Level = "dpanic"
LevelPanic Level = "panic"
LevelFatal Level = "fatal"
// Log Level [panic].
LevelPanic Level = "panic"
// Log Level [fatal].
LevelFatal Level = "fatal"
)

func (l Level) String() string {
Expand Down
15 changes: 15 additions & 0 deletions internal/pkg/log/level_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package log_test

import (
"testing"

"github.com/stretchr/testify/assert"

"go.opentelemetry.io/auto/internal/pkg/log"
)

Expand Down

0 comments on commit 8dc0545

Please sign in to comment.