Skip to content

Commit

Permalink
remove description
Browse files Browse the repository at this point in the history
  • Loading branch information
burmudar committed Oct 18, 2023
1 parent 4a174e4 commit c9c6af5
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/example/main.go
Expand Up @@ -13,7 +13,7 @@ func main() {
})
defer liblog.Sync()

l := log.Scoped("foo", "an example logger")
l := log.Scoped("foo")

// print diagnostics
config := []log.Field{}
Expand Down
2 changes: 1 addition & 1 deletion init.go
Expand Up @@ -98,7 +98,7 @@ func Init(r Resource, s ...Sink) *PostInitCallbacks {

if sinksBuildErr != nil {
// Log the error
Scoped("log.init", "logger initialization").
Scoped("log.init").
Fatal("sinks initialization failed", Error(sinksBuildErr))
}

Expand Down
2 changes: 1 addition & 1 deletion internal/configurable/logger_test.go
Expand Up @@ -14,7 +14,7 @@ func TestCast(t *testing.T) {
log.Init(log.Resource{Name: t.Name()})

// Cast works
cl := configurable.Cast(log.Scoped("foo", "bar"))
cl := configurable.Cast(log.Scoped("foo"))

// Core wrapping works
_ = cl.WithCore(func(c zapcore.Core) zapcore.Core {
Expand Down
2 changes: 1 addition & 1 deletion internal/sinkcores/sentrycore/integration_test.go
Expand Up @@ -82,7 +82,7 @@ func TestTags(t *testing.T) {
e := errors.New("test error")
t.Run("scope", func(t *testing.T) {
logger, tr, sync := newTestLogger(t)
logger = logger.Scoped("my-scope", "testing scope tags")
logger = logger.Scoped("my-scope")
logger.Error("msg", log.Error(e))
sync()
assert.Len(t, tr.Events(), 1)
Expand Down
10 changes: 5 additions & 5 deletions logger.go
Expand Up @@ -30,7 +30,7 @@ type Logger interface {
//
// Scopes map to OpenTelemetry InstrumentationScopes:
// https://opentelemetry.io/docs/reference/specification/logs/data-model/#field-instrumentationscope
Scoped(scope string, description string) Logger
Scoped(scope string) Logger

// With creates a new Logger with the given fields as attributes.
//
Expand Down Expand Up @@ -87,7 +87,7 @@ type Logger interface {
//
// When testing, you should use 'logtest.Scoped(*testing.T)' instead - learn more:
// https://docs.sourcegraph.com/dev/how-to/add_logging#testing-usage
func Scoped(scope string, description string) Logger {
func Scoped(scope string) Logger {
safeGet := !globallogger.DevMode() // do not panic in prod
root := globallogger.Get(safeGet)
adapted := &zapAdapter{
Expand All @@ -99,9 +99,9 @@ func Scoped(scope string, description string) Logger {
if globallogger.DevMode() {
// In development, don't add the OpenTelemetry "Attributes" namespace which gets
// rather difficult to read.
return adapted.Scoped(scope, description)
return adapted.Scoped(scope)
}
return adapted.Scoped(scope, description).With(otelfields.AttributesNamespace)
return adapted.Scoped(scope).With(otelfields.AttributesNamespace)
}

// NoOp returns a no-op Logger that can never produce any output. It can be safely created
Expand Down Expand Up @@ -137,7 +137,7 @@ type zapAdapter struct {

var _ Logger = &zapAdapter{}

func (z *zapAdapter) Scoped(scope string, description string) Logger {
func (z *zapAdapter) Scoped(scope string) Logger {
var newFullScope string
if z.fullScope == "" {
newFullScope = scope
Expand Down
2 changes: 1 addition & 1 deletion logtest/logtest.go
Expand Up @@ -119,7 +119,7 @@ func scopedTestLogger(t testing.TB, options LoggerOptions) log.Logger {
// On cleanup, flush the global logger.
t.Cleanup(func() { globallogger.Get(true).Sync() })

root := log.Scoped(t.Name(), "")
root := log.Scoped(t.Name())

// Cast into internal API
cl := configurable.Cast(root)
Expand Down
2 changes: 1 addition & 1 deletion sinks.go
Expand Up @@ -32,7 +32,7 @@ func (s sinks) update(get SinksConfigGetter) func() {
updated := get()
for _, sink := range s {
if err := sink.update(updated); err != nil {
Scoped("log.sinks.update", "configuration updates").
Scoped("log.sinks.update").
Error("failed to update", String("sink", sink.Name()), Error(err))
}
}
Expand Down

0 comments on commit c9c6af5

Please sign in to comment.