Zapz: Uber's Zap --> logzio
Zapz creates a zap.Logger that sends logs to logzio. This creates a custom WriterSync that buffers data on disk and drains every 5 seconds.
Zapz uses logzio-go to transport logs via HTTP
$ go get -u github.com/dougEfresh/zapz
package main
import (
"os"
"github.com/dougEfresh/zapz"
)
func main() {
l, err := zapz.New(os.Args[1]) //logzio token required
if err != nil {
panic(err)
}
l.Info("tester")
// Logs are buffered on disk, this will flush it
if l.Sync() != nil {
panic("oops")
}
}
- Go to Logzio website
- Sign in with your Logzio account
- Click the top menu gear icon (Account)
- The Logzio token is given in the account page
Set Debug level: zapz.New(token, zapz.SetLevel(zapcore.DebugLevel))
Set CustomEncoder config: zapz.New(token, zapz.SetEncodeConfig(cfg))
Set Custom log type:
A type field is created by default: zap.String("type", "zap-logger"). You can change it like so zapz.New(token, zapz.SetType(logzType))
go 1.x
$ go test -v
All PRs are welcome
- Douglas Chimento - dougEfresh
This project is licensed under the Apache License - see the LICENSE file for details