|
|
@ -22,7 +22,8 @@ func ExampleFormatWithBracket() { |
|
|
|
ctx := context.Background() |
|
|
|
logger := log.New(log.WithFormat(log.FormatWithBracket()), log.WithStdout()).With( |
|
|
|
log.WithSource(10, filepath.Base), |
|
|
|
|
|
|
|
// log.WithTime(log.KeyTime, time.RFC3339),
|
|
|
|
exampleWithTime(log.KeyTime, time.RFC3339), |
|
|
|
log.WithLevel(log.KeyLevel, level.Info), |
|
|
|
) |
|
|
|
|
|
|
@ -31,6 +32,6 @@ func ExampleFormatWithBracket() { |
|
|
|
serviceLogger := logger.With(log.WithName("service_name")) |
|
|
|
serviceLogger.Err(ctx, "error message") |
|
|
|
// Output:
|
|
|
|
// 2038-01-19T06:14:07+03:00 [info] writer_example_test.go:29 "imfo message" num=42
|
|
|
|
// 2038-01-19T06:14:07+03:00 [error][service_name] writer_example_test.go:32 "error message"
|
|
|
|
// 2038-01-19T06:14:07+03:00 [info] writer_example_test.go:30 "imfo message" num=42
|
|
|
|
// 2038-01-19T06:14:07+03:00 [error][service_name] writer_example_test.go:33 "error message"
|
|
|
|
} |
|
|
|