MCPcopy Create free account
hub / github.com/go-logr/logr / Example

Function Example

example_test.go:37–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func Example() {
38 l := NewStdoutLogger()
39 l.Info("default info log", "stringVal", "value", "intVal", 12345)
40 l.V(0).Info("V(0) info log", "stringVal", "value", "intVal", 12345)
41 l.Error(fmt.Errorf("an error"), "error log", "stringVal", "value", "intVal", 12345)
42 // Output:
43 // "level"=0 "msg"="default info log" "stringVal"="value" "intVal"=12345
44 // "level"=0 "msg"="V(0) info log" "stringVal"="value" "intVal"=12345
45 // "msg"="error log" "error"="an error" "stringVal"="value" "intVal"=12345
46}
47
48func ExampleLogger_Info() {
49 l := NewStdoutLogger()

Callers

nothing calls this directly

Calls 4

VMethod · 0.80
NewStdoutLoggerFunction · 0.70
InfoMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected