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

Function ExampleFatal

log/log_example_test.go:112–123  ·  view source on GitHub ↗

Example of a log at a particular "level" (in this case, "fatal")

()

Source from the content-addressed store, hash-verified

110
111// Example of a log at a particular "level" (in this case, "fatal")
112func ExampleFatal() {
113 setup()
114 err := errors.New("A repo man spends his life getting into tense situations")
115 service := "myservice"
116
117 log.Fatal().
118 Err(err).
119 Str("service", service).
120 Msgf("Cannot start %s", service)
121
122 // Outputs: {"level":"fatal","time":1199811905,"error":"A repo man spends his life getting into tense situations","service":"myservice","message":"Cannot start myservice"}
123}
124
125// Example of a log at a particular "level" (in this case, "panic")
126func ExamplePanic() {

Callers

nothing calls this directly

Calls 5

FatalFunction · 0.92
setupFunction · 0.85
MsgfMethod · 0.80
ErrMethod · 0.65
StrMethod · 0.45

Tested by

no test coverage detected