zap
zap copied to clipboard
Blazing fast, structured, leveled logging in Go.
Hello, I tried to use zap with the linux `logrotate`, but when `stdout.log` is rotated to `stdout.log.1` and a new `stdout.log` is created, zap still writes to the old `stdout.log.1`....
Is there a way to modify configuration or some tweak in caller configuration so that I can as well have a function name along with filename and line. Currently I...
Since I use pkg/errors, each error satisfies the `fmt.Formatter` interface and thus, every error log comes with a cause trace in the `errorVerbose` field.. This is great in production, but...
By default, consoleEncoder add '\t' to separator elements, can provide customization capabilities? ``` func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) { line := bufferpool.Get() ... for i :=...
I've been futzing with an HTTP middleware (using `echo`) to log through `zap`, and then on to Stackdriver (GCP logging). One thing I noticed was that the caller information logged...
float NaN, +Inf, -Inf are encoded as corresponding string, which is inconsistent with json.Marshal in golang stdlib. json.Marshal will return error if float value can not be encoded in json....
By default, `jsonEncoder` encodes bytes using base64. In my case, it would be much more useful if bytes are encoded using hex encoding. I tried to build a wrapper around...
I use pkg/errors. When I print the error, I found that errorVerbose and stacktrace are the same. What is the purpose of errorVerbose? err := errors.New("hahaha") zapLogger.Error("test", zap.Error(err)) { "level":...
We should color the output under the development config for better readability in a console. Some ideas, - Color log lines based on levels - Use a muted color for...
Using this file: ~~~go package main import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" ) func main() { config := zap.NewDevelopmentConfig() config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder logger, _ := config.Build() logger.Info("aaaaa bbbbb") } ~~~ I get...