Skip to content

Add ability to override exit function #397

@nickpalmer

Description

@nickpalmer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions