Skip to content

Commit 006e3aa

Browse files
committed
trace2: log 'Fatal*()' error to console
The 'Trace2.Fatal*()' functions log the specified error to the Trace2 output, but not to the console (unlike 'log.Fatal()'). Replace the call to 'Trace2.Exit()' with 'Trace2.logExit()' + 'log.Fatal*()' to ensure the error is shown properly. Signed-off-by: Victoria Dye <[email protected]>
1 parent 220b84a commit 006e3aa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/log/trace2.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package log
33
import (
44
"context"
55
"fmt"
6+
"log"
67
"os"
78
"os/exec"
89
"path"
@@ -322,9 +323,11 @@ func (t *Trace2) Exit(ctx context.Context, exitCode int) {
322323
}
323324

324325
func (t *Trace2) Fatal(ctx context.Context, err error) {
325-
t.Exit(ctx, 1)
326+
t.logExit(ctx, 1)
327+
log.Fatal(err)
326328
}
327329

328330
func (t *Trace2) Fatalf(ctx context.Context, format string, a ...any) {
329-
t.Exit(ctx, 1)
331+
t.logExit(ctx, 1)
332+
log.Fatalf(format, a...)
330333
}

0 commit comments

Comments
 (0)