Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jettison not logging as JSON #2

Open
peterlabuschagne opened this issue Nov 27, 2020 · 0 comments
Open

Jettison not logging as JSON #2

peterlabuschagne opened this issue Nov 27, 2020 · 0 comments

Comments

@peterlabuschagne
Copy link

Hi

The readme suggests that jettison/log provides structured JSON logging, but when I use both
log.Info(ctx, "entering the example function", jettison.WithKeyValueString("key", "value"))
and
log.Error(nil, err, jettison.WithKeyValueString("another_key", "another_value"))
neither prints the error to stdout as JSON. I also can't find configurable options to specify that the output JSON.

Below is an example of the output I receive when running jettison/example:

`I 15:59:02.085 g/l/j/e/serverclient/client.go:39: serverclient: Performing a hop to another server[ctx_key=ctx_value,ctx_key2=ctx_value2,ctx_key3=ctx_value3,hops=2]
I 15:59:02.086 g/l/j/e/serverclient/server.go:30: serverclient: Received a Hop request from a client[ctx_key=ctx_value,ctx_key2=ctx_value2,ctx_key3=ctx_value3]
I 15:59:02.086 g/l/j/e/serverclient/client.go:39: serverclient: Performing a hop to another server[ctx_key=ctx_value,ctx_key2=ctx_value2,ctx_key3=ctx_value3,hops=1]
I 15:59:02.086 g/l/j/e/serverclient/server.go:30: serverclient: Received a Hop request from a client[ctx_key=ctx_value,ctx_key2=ctx_value2,ctx_key3=ctx_value3]
E 15:59:02.086 example/example.go:33: serverclient: error hopping: serverclient: run out of hops[hops=1,hops=0]
example: []
example:

  • github.com/luno/jettison/example/serverclient/server.go:38
  • github.com/luno/jettison/example/examplepb/example.pb.go:153
  • github.com/luno/jettison/interceptors/interceptors.go:48
  • github.com/luno/jettison/example/examplepb/example.pb.go:155
  • google.golang.org/[email protected]/server.go:999
  • google.golang.org/[email protected]/server.go:1279
  • google.golang.org/[email protected]/server.go:717
  • runtime/asm_amd64.s:1374
    example:
  • github.com/luno/jettison/example/serverclient/server.go:33
  • github.com/luno/jettison/example/examplepb/example.pb.go:153
  • github.com/luno/jettison/interceptors/interceptors.go:48
  • github.com/luno/jettison/example/examplepb/example.pb.go:155
  • google.golang.org/[email protected]/server.go:999
  • google.golang.org/[email protected]/server.go:1279
  • google.golang.org/[email protected]/server.go:717
  • runtime/asm_amd64.s:1374`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant