oops
oops copied to clipboard
Zap example
Hi @samber,
I tried using oops with zap here is my example:
func main() {
logger, _ := zap.NewProduction()
err := oops.
In("repository").
Tags("database", "sql").
With("deneme", "mehmet").
Errorf("could not fetch user")
logger.Error(err.Error(), zap.Error(err))
}
{"level":"error","ts":1684233642.017879,"caller":"test-api/main.go:17","msg":"could not fetch user","error":"could not fetch user","errorVerbose":"Oops: could not fetch user\nAt: 2023-05-16 10:40:42.017789 +0000 UTC\nDomain: repository\nTags: database, sql\nContext:\n * deneme: mehmet\nStackstrace:\nOops: could not fetch user\n --- at test-api/main.go:15 main()\n","stacktrace":"main.main/test-api/main.go:17"}
I couldn't achieve the log structure like your example in readme, would be great if I get errorVerbose as a json.