()
| 79 | } |
| 80 | |
| 81 | func Example_debugInfo() { |
| 82 | logger := log.NewLogfmtLogger(os.Stdout) |
| 83 | |
| 84 | // make time predictable for this test |
| 85 | baseTime := time.Date(2015, time.February, 3, 10, 0, 0, 0, time.UTC) |
| 86 | mockTime := func() time.Time { |
| 87 | baseTime = baseTime.Add(time.Second) |
| 88 | return baseTime |
| 89 | } |
| 90 | |
| 91 | logger = log.With(logger, "time", log.Timestamp(mockTime), "caller", log.DefaultCaller) |
| 92 | |
| 93 | logger.Log("call", "first") |
| 94 | logger.Log("call", "second") |
| 95 | |
| 96 | // ... |
| 97 | |
| 98 | logger.Log("call", "third") |
| 99 | |
| 100 | // Output: |
| 101 | // time=2015-02-03T10:00:01Z caller=example_test.go:93 call=first |
| 102 | // time=2015-02-03T10:00:02Z caller=example_test.go:94 call=second |
| 103 | // time=2015-02-03T10:00:03Z caller=example_test.go:98 call=third |
| 104 | } |
| 105 | |
| 106 | func Example_syncWriter() { |
| 107 | w := log.NewSyncWriter(os.Stdout) |
nothing calls this directly
no test coverage detected
searching dependent graphs…