MCPcopy
hub / github.com/rs/zerolog / ExampleLogger_Hook

Function ExampleLogger_Hook

log_example_test.go:71–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func ExampleLogger_Hook() {
72 var levelNameHook LevelNameHook
73 var messageHook MessageHook = "The message"
74
75 log := zerolog.New(os.Stdout).Hook(levelNameHook, messageHook)
76
77 log.Info().Msg("hello world")
78
79 // Output: {"level":"info","level_name":"info","the_message":"hello world","message":"hello world"}
80}
81
82func ExampleLogger_Print() {
83 log := zerolog.New(os.Stdout)

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
HookMethod · 0.80
MsgMethod · 0.80
InfoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…