go-ping / ping

ICMP Ping library for Go
MIT License
1.31k stars 344 forks source link

Remove uses of Fatalf which causes the application to quit if a custom logger is provided such as Uber zap #214

Closed stanimirivanovde closed 1 year ago

stanimirivanovde commented 2 years ago

Uber zap's logger does os.Exit() if Fatal() or Fatalf() is called. Since go-ping supports custom loggers and in my case I pass in Uber zap's logger this causes my entire application to exit. Removing Fatal() calls is safer. If we need to ensure this error is handled up the call chain we can panic() which is better since the code can recover from a panic. The code cannot recover from an os.Exit() call.

SuperQ commented 1 year ago

See https://github.com/go-ping/ping/pull/226