Example of using the Logger Hook function to add hooks
()
| 204 | |
| 205 | // Example of using the Logger Hook function to add hooks |
| 206 | func ExampleLogger_Hook() { |
| 207 | setup() |
| 208 | |
| 209 | hooked := log.Hook(captainHook) |
| 210 | hooked.Info().Msg("watch out!") |
| 211 | // Output: {"level":"info","time":1199811905,"key":null,"is_error":false,"msg_len":10,"message":"watch out!"} |
| 212 | } |
| 213 | |
| 214 | // Example of using the WithLevel function to set the log level |
| 215 | func ExampleWithLevel() { |