Skip to content

Commit 82ac8be

Browse files
committed
fix WithLogger option
1 parent 63089e5 commit 82ac8be

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

options.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,15 @@ func WithErrWriter(err io.Writer) LoggerOption {
137137
}
138138

139139
func WithLogger(details trace.Details, opts ...LoggerOption) Option {
140-
return func(ctx context.Context, c *connection) error {
141-
nativeOpts := make([]logger.Option, 0, len(opts))
142-
for _, o := range opts {
143-
nativeOpts = append(nativeOpts, logger.Option(o))
144-
}
145-
l := logger.New(nativeOpts...)
146-
if err := WithTraceDriver(log.Driver(l, details))(ctx, c); err != nil {
147-
return err
148-
}
149-
return WithTraceTable(log.Table(l, details))(ctx, c)
140+
loggerOpts := make([]logger.Option, 0, len(opts))
141+
for _, o := range opts {
142+
loggerOpts = append(loggerOpts, logger.Option(o))
150143
}
144+
l := logger.New(loggerOpts...)
145+
return MergeOptions(
146+
WithTraceDriver(log.Driver(l, details)),
147+
WithTraceTable(log.Table(l, details)),
148+
)
151149
}
152150

153151
func WithAnonymousCredentials() Option {

0 commit comments

Comments
 (0)