Browse Source

add eample log time

pull/15/head
andrey 11 months ago
parent
commit
4a61b678cf
  1. 7
      writer_example_test.go

7
writer_example_test.go

@ -22,7 +22,8 @@ func ExampleFormatWithBracket() {
ctx := context.Background() ctx := context.Background()
logger := log.New(log.WithFormat(log.FormatWithBracket()), log.WithStdout()).With( logger := log.New(log.WithFormat(log.FormatWithBracket()), log.WithStdout()).With(
log.WithSource(10, filepath.Base), log.WithSource(10, filepath.Base),
// log.WithTime(log.KeyTime, time.RFC3339),
exampleWithTime(log.KeyTime, time.RFC3339),
log.WithLevel(log.KeyLevel, level.Info), log.WithLevel(log.KeyLevel, level.Info),
) )
@ -31,6 +32,6 @@ func ExampleFormatWithBracket() {
serviceLogger := logger.With(log.WithName("service_name")) serviceLogger := logger.With(log.WithName("service_name"))
serviceLogger.Err(ctx, "error message") serviceLogger.Err(ctx, "error message")
// Output: // 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 [info] writer_example_test.go:30 "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 [error][service_name] writer_example_test.go:33 "error message"
} }

Loading…
Cancel
Save