MCPcopy
hub / github.com/go-kit/kit / Example_debugInfo

Function Example_debugInfo

log/example_test.go:81–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81func 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
106func Example_syncWriter() {
107 w := log.NewSyncWriter(os.Stdout)

Callers

nothing calls this directly

Calls 5

NewLogfmtLoggerFunction · 0.92
WithFunction · 0.92
TimestampFunction · 0.92
AddMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…