You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
663 B
21 lines
663 B
package log_test
|
|
|
|
import (
|
|
"gitoa.ru/go-4devs/log"
|
|
"gitoa.ru/go-4devs/log/level"
|
|
)
|
|
|
|
func ExampleNew_withCaller() {
|
|
logger := log.New(log.WithStdout()).With(
|
|
log.WithLevel(log.KeyLevel, level.Debug),
|
|
log.WithSource(3),
|
|
)
|
|
logger.Err(ctx, "same error message")
|
|
logger.InfoKVs(ctx, "same info message", "api-version", 0.1)
|
|
_, _ = logger.Write([]byte("same write message"))
|
|
|
|
// Output:
|
|
// msg="same error message" level=error source=log/logger_example_caller_test.go:13
|
|
// msg="same info message" api-version=0.1 level=info source=log/logger_example_caller_test.go:14
|
|
// msg="same write message" level=info source=log/logger_example_caller_test.go:15
|
|
}
|
|
|