Wrapper for zerolog tuned to work with configuration and sentry hook.
Initiate new logger with filled log.Config
and use it as common zerolog
package main
import (
log "github.com/spacetab-io/logs-go/v2"
)
func main() {
conf := log.Config{
Level: "warn",
Format: "text",
Caller: &log.CallerConfig{
Disabled: false,
CallerSkipFrames: 2,
},
Sentry: &log.SentryConfig{
Enable: true,
DSN: "http://dsn.sentry.com",
},
}
if err := log.Init("test", conf, "logs-go", "v2.*.*", nil); err != nil {
panic(err)
}
log.Warn().Msg("log some warning")
}
The software is provided under MIT Licence.