log-zap
log-zap is wrapper of go.uber.org/zap for log
Usage
package main
import (
"log"
hlog "github.com/go-haru/log"
logger "github.com/go-haru/log-zap"
)
func main() {
var config = logger.Options{
Level: hlog.InfoLevel.String(),
Format: logger.FormatText,
LongTime: true,
WithColor: true,
}
// build wrapped zap logger
var zapLogger, err = logger.New(config)
if err != nil {
panic(err)
}
// register logger
hlog.Use(zapLogger)
// takeover sdk logger's output
log.SetFlags(0)
log.SetOutput(zapLogger.
WithLevel(hlog.InfoLevel).
AddDepth(-1).
Standard().Writer(),
)
}
Contributing
For convenience of PM, please commit all issue to Document Repo.
License
This project is licensed under the Apache License Version 2.0
.
Use and contributions signify your agreement to honor the terms of this LICENSE.
Commercial support or licensing is conditionally available through organization email.