zapdriver icon indicating copy to clipboard operation
zapdriver copied to clipboard

Labels field is included twice in output

Open tv42 opened this issue 4 years ago • 2 comments

logging.googleapis.com/labels gets included twice, once with the intended content and again as an empty object.

"logging.googleapis.com/labels":{"hello":"world","hi":"universe"},"logging.googleapis.com/labels":{},
$ cat go.mod 
module example.com/m

go 1.14

require github.com/blendle/zapdriver v1.3.1

$ cat main.go 
package main

import (
        "log"

        "github.com/blendle/zapdriver"
)

func main() {
        logger, err := zapdriver.NewProduction()
        if err != nil {
                log.Fatal(err)
        }
        logger.Info(
                "Did something.",
                zapdriver.Labels(
                        zapdriver.Label("hello", "world"),
                        zapdriver.Label("hi", "universe"),
                ),
        )
}

$ go run .
{"severity":"INFO","timestamp":"2020-05-12T15:15:43.21090722-06:00","caller":"z/main.go:14","message":"Did something.","logging.googleapis.com/labels":{"hello":"world","hi":"universe"},"logging.googleapis.com/labels":{},"logging.googleapis.com/sourceLocation":{"file":"/home/tv/z/main.go","line":"14","function":"main.main"}} 

tv42 avatar May 12 '20 21:05 tv42

Thanks for the report @tv42, good catch!

I've provided a fix in #30. Unfortunately I no longer have the commit bit for this repo, but I'm sure someone from Blendle will merge that PR soon and add a new tagged release 😄

JeanMertz avatar May 13 '20 07:05 JeanMertz

Any update on this? Looks like the PR still hasn't been merged 😢

jordanpotter avatar Sep 11 '20 04:09 jordanpotter