Example of a log at a particular "level" (in this case, "panic")
()
| 124 | |
| 125 | // Example of a log at a particular "level" (in this case, "panic") |
| 126 | func ExamplePanic() { |
| 127 | setup() |
| 128 | |
| 129 | log.Panic().Msg("Cannot start") |
| 130 | // Outputs: {"level":"panic","time":1199811905,"message":"Cannot start"} then panics |
| 131 | } |
| 132 | |
| 133 | // This example uses command-line flags to demonstrate various outputs |
| 134 | // depending on the chosen log level. |