Skip to content

Commit

Permalink
Add 'WithLevelEnabler' function instead of modifying signature of 'Wi…
Browse files Browse the repository at this point in the history
…thLevel'.
  • Loading branch information
jenshans committed Dec 2, 2024
1 parent d3e3226 commit dbc6d8c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion otelzap/otelzap.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ func NewOtelCore(loggerProvider otel.LoggerProvider, opts ...Option) zapcore.Cor
type Option func(c *otlpCore)

// WithLevel sets the minimum level for the OpenTelemetry Core log to be exported
func WithLevel(levelEnabler zapcore.LevelEnabler) Option {
func WithLevel(level zapcore.Level) Option {
return Option(func(c *otlpCore) {
c.levelEnabler = level
})
}

// WithLevelEnabler sets the zapcore.LevelEnabler for determining which log levels to export
func WithLevelEnabler(levelEnabler zapcore.LevelEnabler) Option {
return Option(func(c *otlpCore) {
c.levelEnabler = levelEnabler
})
Expand Down

0 comments on commit dbc6d8c

Please sign in to comment.