/examples/hook/hook.go with it's child dependency on airbrake/gobrake is
not backwards compatible pre-go1.6 due to use of the following:
- os.LookupEnv (introduced in go1.5)
- http.StatusTooManyRequests (introduced in go1.6)
ignoring the fetch and explicit test of /examples/ fixes failing go1.3,
go1.4, go1.5 builds.
There are two different code paths for rendering a key/value pair. The
non-color version uses a type switch that handles specific types such as
"error", and the color version uses the %+v printf format specifier.
This causes an inconsistency between the two formats. In particular,
errors created using the github.com/pkg/errors package will include a
stack trace of where the error was created when printed to the terminal,
but not to a file. Printing the stack trace as part of the log field is
probably not the right behavior.
The output is also inconsistent between the two forms because strings
are not quoted/escaped when colors are used. This can make log output
unparseable.
Fix this by making both code paths use the type switch and escaping
rules. Fix the escaping code to pass the error value to Fprintf, not the
error itself, which seems to be necessary to avoid blank output with
errors created by github.com/pkg/errors.
Locking is enabled by default. When file is opened with appending mode,
it's safe to write concurrently to a file. In this case user can
choose to disable the lock.
While GO offers the ability to recover from panic there is no way to intercept an os.Exit event. To allow graceful shutdown and clean-up or programs which use Logrus to Fatal out I've borrowed ideas from the `atexit` package and enhanced Logrus.
Usage:
* When setting up the logger one call `RegisterExitHandler( func() {...} )` to add a handler that will be invoked for any `Fatal` call to the logger.