|
@ -66,7 +66,7 @@ func ExampleNew_jsonFormat() { |
|
|
log.GoVersion("go-version"), |
|
|
log.GoVersion("go-version"), |
|
|
) |
|
|
) |
|
|
logger.Err(ctx, "same error message") |
|
|
logger.Err(ctx, "same error message") |
|
|
// Output: {"go-version":"go1.17.1","level":"error","msg":"same error message"}
|
|
|
// Output: {"go-version":"go1.17.6","level":"error","msg":"same error message"}
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func ExampleNew_textEncoding() { |
|
|
func ExampleNew_textEncoding() { |
|
@ -79,8 +79,8 @@ func ExampleNew_textEncoding() { |
|
|
logger.InfoKVs(ctx, "same info message", "api-version", 0.1) |
|
|
logger.InfoKVs(ctx, "same info message", "api-version", 0.1) |
|
|
|
|
|
|
|
|
// Output:
|
|
|
// Output:
|
|
|
// msg="same error message" level=error go-version=go1.17.1
|
|
|
// msg="same error message" level=error go-version=go1.17.6
|
|
|
// msg="same info message" api-version=0.1 level=info go-version=go1.17.1
|
|
|
// msg="same info message" api-version=0.1 level=info go-version=go1.17.6
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type ctxKey string |
|
|
type ctxKey string |
|
@ -102,7 +102,7 @@ func ExampleWith() { |
|
|
levelInfo, log.WithContextValue(requestID), log.KeyValue("api", "0.1.0"), log.GoVersion("go"), |
|
|
levelInfo, log.WithContextValue(requestID), log.KeyValue("api", "0.1.0"), log.GoVersion("go"), |
|
|
) |
|
|
) |
|
|
logger.Info(vctx, "same message") |
|
|
logger.Info(vctx, "same message") |
|
|
// Output: msg="same message" level=info requestID=6a5fa048-7181-11ea-bc55-0242ac130003 api=0.1.0 go=go1.17.1
|
|
|
// Output: msg="same message" level=info requestID=6a5fa048-7181-11ea-bc55-0242ac130003 api=0.1.0 go=go1.17.6
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func ExampleLogger_Print() { |
|
|
func ExampleLogger_Print() { |
|
@ -111,7 +111,7 @@ func ExampleLogger_Print() { |
|
|
levelInfo, log.KeyValue("client", "http"), log.KeyValue("api", "0.1.0"), log.GoVersion("go"), |
|
|
levelInfo, log.KeyValue("client", "http"), log.KeyValue("api", "0.1.0"), log.GoVersion("go"), |
|
|
) |
|
|
) |
|
|
logger.Print("same message") |
|
|
logger.Print("same message") |
|
|
// Output: msg="same message" level=info client=http api=0.1.0 go=go1.17.1
|
|
|
// Output: msg="same message" level=info client=http api=0.1.0 go=go1.17.6
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func ExamplePrint() { |
|
|
func ExamplePrint() { |
|
|