Skip to content

Commit

Permalink
check if there's processors
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed Jul 8, 2024
1 parent 8ff8084 commit d8f5ce0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions service/telemetry/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ func newLogger(ctx context.Context, cfg LogsConfig, options []zap.Option) (*zap.

logger, err := zapCfg.Build(options...)

logger = logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
return otelzap.NewCore("my/pkg/name", otelzap.WithLoggerProvider(sdk.LoggerProvider()))
}))
if len(cfg.Processors) > 0 {
logger = logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
return otelzap.NewCore("my/pkg/name", otelzap.WithLoggerProvider(sdk.LoggerProvider()))
}))
}

if err != nil {
return nil, err
Expand Down

0 comments on commit d8f5ce0

Please sign in to comment.