Skip to content

Commit

Permalink
revert removing of fatal logs (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
srijan-27 authored Jul 12, 2024
1 parent ae6b06c commit f236953
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/gofr/logging/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type Logger interface {
Warnf(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
ChangeLevel(level Level)
}

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

func (l *logger) Fatal(args ...interface{}) {
l.logf(FATAL, "", args...)

//nolint:revive // exit status is 1 as it denotes failure as signified by Fatal log
os.Exit(1)
}

func (l *logger) Fatalf(format string, args ...interface{}) {
l.logf(FATAL, format, args...)

//nolint:revive // exit status is 1 as it denotes failure as signified by Fatal log
os.Exit(1)
}

func (l *logger) prettyPrint(e logEntry, out io.Writer) {
// Note: we need to lock the pretty print as printing to stdandard output not concurency safe
// the logs when printed in go routines were getting missaligned since we are achieveing
Expand Down

0 comments on commit f236953

Please sign in to comment.