'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log *(in plugin module, they're 'warn'/'error' level). */
| 101 | /*'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log |
| 102 | *(in plugin module, they're 'warn'/'error' level). */ |
| 103 | static void warning_notification_serialize(struct json_stream *stream, |
| 104 | enum log_level level, |
| 105 | struct timeabs time, |
| 106 | const char *source, |
| 107 | const char *logmsg) |
| 108 | { |
| 109 | /* Choose "BROKEN"/"UNUSUAL" to keep consistent with the habit |
| 110 | * of plugin. But this may confuses the users who want to 'getlog' |
| 111 | * with the level indicated by notifications. It is the duty of a |
| 112 | * plugin to eliminate this misunderstanding. */ |
| 113 | json_add_string(stream, "level", |
| 114 | level == LOG_BROKEN ? "error" |
| 115 | : "warn"); |
| 116 | /* unsuaul/broken event is rare, plugin pay more attentions on |
| 117 | * the absolute time, like when channels failed. */ |
| 118 | json_add_timestr(stream, "time", time.ts); |
| 119 | json_add_timeiso(stream, "timestamp", time); |
| 120 | json_add_string(stream, "source", source); |
| 121 | json_add_string(stream, "log", logmsg); |
| 122 | } |
| 123 | |
| 124 | REGISTER_NOTIFICATION(warning); |
| 125 |
no test coverage detected