()
| 48 | } |
| 49 | |
| 50 | func ExampleWithContext() { |
| 51 | bag, ctx := ctxmeta.Inject(context.Background()) |
| 52 | bag.Set("clientIp", "127.0.0.1") |
| 53 | bag.Set("requestUrl", "/example") |
| 54 | bag.Set("transport", "http") |
| 55 | logger := logging.NewLogger("json") |
| 56 | ctxLogger := logging.WithContext(logger, ctx) |
| 57 | ctxLogger.Log("foo", "bar") |
| 58 | // Output: |
| 59 | // {"clientIp":"127.0.0.1","foo":"bar","requestUrl":"/example","transport":"http"} |
| 60 | } |
nothing calls this directly
no test coverage detected