Skip to content

Commit f236953

Browse files
authored
revert removing of fatal logs (gofr-dev#842)
1 parent ae6b06c commit f236953

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/gofr/logging/logger.go

+16
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type Logger interface {
3232
Warnf(format string, args ...interface{})
3333
Error(args ...interface{})
3434
Errorf(format string, args ...interface{})
35+
Fatal(args ...interface{})
36+
Fatalf(format string, args ...interface{})
3537
ChangeLevel(level Level)
3638
}
3739

@@ -130,6 +132,20 @@ func (l *logger) Errorf(format string, args ...interface{}) {
130132
l.logf(ERROR, format, args...)
131133
}
132134

135+
func (l *logger) Fatal(args ...interface{}) {
136+
l.logf(FATAL, "", args...)
137+
138+
//nolint:revive // exit status is 1 as it denotes failure as signified by Fatal log
139+
os.Exit(1)
140+
}
141+
142+
func (l *logger) Fatalf(format string, args ...interface{}) {
143+
l.logf(FATAL, format, args...)
144+
145+
//nolint:revive // exit status is 1 as it denotes failure as signified by Fatal log
146+
os.Exit(1)
147+
}
148+
133149
func (l *logger) prettyPrint(e logEntry, out io.Writer) {
134150
// Note: we need to lock the pretty print as printing to stdandard output not concurency safe
135151
// the logs when printed in go routines were getting missaligned since we are achieveing

0 commit comments

Comments
 (0)