Skip to content

Commit 0d8ebe3

Browse files
committed
fix: pass in args to fatal exit func
1 parent 59f12ee commit 0d8ebe3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

io/logger.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type StandardLogger struct {
2525
archiveDir string
2626
archiveFile *os.File
2727
outFile *os.File
28-
exitFunc func()
28+
exitFunc func(msg string, args ...any)
2929
}
3030

3131
type LoggerOptions func(*StandardLogger)
@@ -70,7 +70,7 @@ func WithArchiveDirectory(path string) LoggerOptions {
7070
}
7171
}
7272

73-
func WithExitFunc(exit func()) LoggerOptions {
73+
func WithExitFunc(exit func(msg string, args ...any)) LoggerOptions {
7474
return func(logger *StandardLogger) {
7575
logger.exitFunc = exit
7676
}
@@ -276,7 +276,7 @@ func (l *StandardLogger) Fatalf(msg string, args ...any) {
276276
switch l.mode {
277277
case Text:
278278
l.PlainTextError(fmt.Sprintf(msg, args...))
279-
l.exitFunc()
279+
l.exitFunc(msg, args...)
280280
return
281281
case Hidden:
282282
return
@@ -438,6 +438,6 @@ func (l *StandardLogger) syncLoggerFormat() {
438438
}
439439
}
440440

441-
func defaultExit() {
441+
func defaultExit(_ string, args ...any) {
442442
os.Exit(1)
443443
}

0 commit comments

Comments
 (0)