Skip to content

Commit acc45b3

Browse files
committed
trace2: fix condition for logging error in 'Errorf()'
Change the condition determining whether to log the error from 'if isLogged' to 'if !isLogged', since we want to log the error if it has *not* already been logged. Signed-off-by: Victoria Dye <[email protected]>
1 parent 006e3aa commit acc45b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/log/trace2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func (t *Trace2) Errorf(ctx context.Context, format string, a ...any) error {
308308

309309
err := loggedError(fmt.Errorf(format, a...))
310310

311-
if isLogged {
311+
if !isLogged {
312312
_, sharedFields := t.sharedFields(ctx)
313313
t.logger.Info("error", sharedFields.with(
314314
zap.String("msg", err.Error()),

0 commit comments

Comments
 (0)