zap icon indicating copy to clipboard operation
zap copied to clipboard

Alternative logging through zap

Results 15 zap issues
Sort by recently updated
recently updated
newest added

Hi, When I use default gin.Recovery(), I can set display error into console and write log file: ` gin.DefaultErrorWriter = io.MultiWriter(logger, os.Stderr) ` ` r.Use(gin.Recovery()) ` Now,When I use RecoveryWithZap(),...

Hi, I'm wondering if you'd consider a PR for adding functionality to make it possible to add custom fields to the log statement? E.g. by having something like: ```go func...

Before: ``` {"level":"info","ts":1645300140.072392,"caller":"[email protected]/zap.go:80","msg":"/api/v1/extractors","status":200,"method":"POST","path":"/api/v1/extractors","query":"","ip":"127.0.0.1","user-agent":"curl/7.64.1","latency":0.00029637,"request-id":"58badad1-0c5e-4bfd-893b-cdf4e0686d32","time":"2022-02-19T19:49:00Z"} ``` After: With `X-Request-Id` provided: ``` ❯ curl -v -H 'X-Request-Id: e72b5b68-21e4-4f23-be4f-1a4441f3398c' -H 'Content-Type: application/json' -d '{}' http://127.0.0.1:8088/api/v1/extractors * Trying 127.0.0.1... * TCP_NODELAY set * Connected to...

I do this in a custom middleware I have in my project but I thought why not use your published version. I do need to be able to switch levels...

https://github.com/gin-contrib/zap/blob/062a8ac606569fff538abb3a325b4d387aeb4a69/zap.go#L72 I have also seen such code snippets in the gin framework. Here you have done this again. Is it possible to encapsulate an IsBroken func instead of writing this...

[otelzap](github.com/uptrace/opentelemetry-go-extra/otelzap) is a OpenTelemetry instrumentations for zap logger. as `Ginzap` want actually `zap.Logger`, we can't use the otelzap one, the fix is actually simple, use interface instead of the `zap.Logger`...