|
@ -1,6 +1,8 @@ |
|
|
package log_test |
|
|
package log_test |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
|
"gitoa.ru/go-4devs/log" |
|
|
"gitoa.ru/go-4devs/log" |
|
|
"gitoa.ru/go-4devs/log/level" |
|
|
"gitoa.ru/go-4devs/log/level" |
|
|
) |
|
|
) |
|
@ -8,14 +10,14 @@ import ( |
|
|
func ExampleNew_withCaller() { |
|
|
func ExampleNew_withCaller() { |
|
|
logger := log.New(log.WithStdout()).With( |
|
|
logger := log.New(log.WithStdout()).With( |
|
|
log.WithLevel(log.KeyLevel, level.Debug), |
|
|
log.WithLevel(log.KeyLevel, level.Debug), |
|
|
log.WithSource(3), |
|
|
log.WithSource(3, filepath.Base), |
|
|
) |
|
|
) |
|
|
logger.Err(ctx, "same error message") |
|
|
logger.Err(ctx, "same error message") |
|
|
logger.InfoKVs(ctx, "same info message", "api-version", 0.1) |
|
|
logger.InfoKVs(ctx, "same info message", "api-version", 0.1) |
|
|
_, _ = logger.Write([]byte("same write message")) |
|
|
_, _ = logger.Write([]byte("same write message")) |
|
|
|
|
|
|
|
|
// Output:
|
|
|
// Output:
|
|
|
// msg="same error message" level=error source=log/logger_example_caller_test.go:13
|
|
|
// msg="same error message" level=error source=logger_example_caller_test.go:15
|
|
|
// msg="same info message" api-version=0.1 level=info source=log/logger_example_caller_test.go:14
|
|
|
// msg="same info message" api-version=0.1 level=info source=logger_example_caller_test.go:16
|
|
|
// msg="same write message" level=info source=log/logger_example_caller_test.go:15
|
|
|
// msg="same write message" level=info source=logger_example_caller_test.go:17
|
|
|
} |
|
|
} |
|
|