Example of a log at a particular "level" (in this case, "fatal")
()
| 110 | |
| 111 | // Example of a log at a particular "level" (in this case, "fatal") |
| 112 | func 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") |
| 126 | func ExamplePanic() { |