Zerolog golang logging plugin for go-autumn-logging.
An interface for pluggable logging support with context integration, see go-autumn-logging.
Implementation that pulls in logging using zerolog.
- context aware
- provides context injection middleware for standard golang http server
- fairly good performance
- support for JSON and plaintext logging
Do NOT import this. You are doing it WRONG. You'll take away the application author's choice of logging libraries, which is the whole point of using go-autumn-logging in the first place.
Use go-autumn-logging (the api module) only!
You're all set with this dependency, just make sure you call one of the provided Setup
functions
to set up either JSON or plaintext logging. The simplest example for JSON logging
auzerolog.SetupJsonLogging("application-name")
and for plaintext logging:
auzerolog.SetupPlaintextLogging()
If you don't like our choice of fields or styling, you can easily customize everything by providing your own Setup-style function to call instead.
Use call chaining style:
import "github.com/StephanHCB/go-autumn-logging"
func someFunction(ctx context.Context) {
aulogging.Logger.Ctx(ctx).Warn("something bad has happened")
}
or if you prefer:
import "github.com/StephanHCB/go-autumn-logging"
func someFunction(ctx context.Context) {
aulogging.Warn(ctx, "something bad has happened")
}