π Package Zapper (write logs but easier)
Javad Rajabzadeh
Posted on March 22, 2023
Wrapping the zap log uber in the zapper package makes it easy to use zap to write logs to varianty core.
feature
- available cores (console, file, sentry, json)
- show stacktrace in log
- log file rotation using lumberjack
- create multiple core in same time
- add service details to zapper
- compatibility with ELK using json core
- compatibility with some software architecture scenario
- 100% compatibility with sentry using sentry core
package main
import (
"github.com/GoFarsi/zapper"
"log"
)
func main() {
z := zapper.New(false, zapper.WithDebugLevel())
if err := z.NewCore(
zapper.ConsoleWriterCore(true),
zapper.FileWriterCore("./test_data", nil),
); err != nil {
log.Fatal(err)
}
z.Debug("debug log")
z.Info("info log")
z.Warn("warn log")
z.Error("error log")
}
Repo: https://github.com/GoFarsi/zapper
Document: https://pkg.go.dev/github.com/GoFarsi/zapper
π πͺ π
π©
Javad Rajabzadeh
Posted on March 22, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024