zerolog
zerolog copied to clipboard
Add ability to override exit function
There should be a way to override the os.Exit() function call with a different exit handler.
zerolog.SetExitFunc(exit func(int) {})
// or even via a global
var ExitFunc = os.Exit()
This would allow people to do required cleanup such as closing a log file, or to write tests that call Fatal() and check that fatal was called.
That would be nice because it would allow me to test fatal functions.
Was there ever a solution for this? Looking into how I can write unit tests around a function that uses the log.Fatal() function.