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

Function Example_basic

log/example_test.go:12–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func Example_basic() {
13 logger := log.NewLogfmtLogger(os.Stdout)
14
15 type Task struct {
16 ID int
17 }
18
19 RunTask := func(task Task, logger log.Logger) {
20 logger.Log("taskID", task.ID, "event", "starting task")
21
22 logger.Log("taskID", task.ID, "event", "task complete")
23 }
24
25 RunTask(Task{ID: 1}, logger)
26
27 // Output:
28 // taskID=1 event="starting task"
29 // taskID=1 event="task complete"
30}
31
32func Example_contextual() {
33 logger := log.NewLogfmtLogger(os.Stdout)

Callers

nothing calls this directly

Calls 2

NewLogfmtLoggerFunction · 0.92
LogMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…