rs / zerolog

Zero Allocation JSON Logger
MIT License
10.41k stars 567 forks source link

Is it possible to log to FATAL with custom error code? #536

Closed inliquid closed 1 year ago

inliquid commented 1 year ago

In our cli tool we would like to have a custom error codes depending on some internal reason. However in zerolog log.Fatal is always implicitly calls os.Exit(1), so it looks like it should be avoided.

Is it possible to still have FATAL log level but with custom error codes?

rs commented 1 year ago

Use Level instead.

inliquid commented 1 year ago

Thank you, should we use Level only or WithLevel also suitable?

rs commented 1 year ago

Yes sorry, it is WithLevel not Level.