(t *testing.T)
| 83 | } |
| 84 | |
| 85 | func Test_InterfaceLogObjectMarshaler(t *testing.T) { |
| 86 | var buf bytes.Buffer |
| 87 | log := New(&buf) |
| 88 | ctx := log.WithContext(context.Background()) |
| 89 | |
| 90 | log2 := Ctx(ctx) |
| 91 | |
| 92 | withLog := log2.With().Interface("obj", &logObjectMarshalerImpl{ |
| 93 | name: "FOO", |
| 94 | age: 29, |
| 95 | }).Logger() |
| 96 | |
| 97 | withLog.Info().Msg("test") |
| 98 | |
| 99 | if got, want := cbor.DecodeIfBinaryToString(buf.Bytes()), `{"level":"info","obj":{"name":"foo","age":-29},"message":"test"}`+"\n"; got != want { |
| 100 | t.Errorf("got %q, want %q", got, want) |
| 101 | } |
| 102 | } |
nothing calls this directly
no test coverage detected