'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log *(in plugin module, they're 'warn'/'error' level). */
| 95 | /*'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log |
| 96 | *(in plugin module, they're 'warn'/'error' level). */ |
| 97 | static void warning_notification_serialize(struct json_stream *stream, |
| 98 | struct log_entry *l) |
| 99 | { |
| 100 | json_object_start(stream, "warning"); |
| 101 | /* Choose "BROKEN"/"UNUSUAL" to keep consistent with the habit |
| 102 | * of plugin. But this may confuses the users who want to 'getlog' |
| 103 | * with the level indicated by notifications. It is the duty of a |
| 104 | * plugin to eliminate this misunderstanding. |
| 105 | */ |
| 106 | json_add_string(stream, "level", |
| 107 | l->level == LOG_BROKEN ? "error" |
| 108 | : "warn"); |
| 109 | /* unsuaul/broken event is rare, plugin pay more attentions on |
| 110 | * the absolute time, like when channels failed. */ |
| 111 | json_add_time(stream, "time", l->time.ts); |
| 112 | json_add_timeiso(stream, "timestamp", &l->time); |
| 113 | json_add_string(stream, "source", l->prefix->prefix); |
| 114 | json_add_string(stream, "log", l->log); |
| 115 | json_object_end(stream); /* .warning */ |
| 116 | } |
| 117 | |
| 118 | REGISTER_NOTIFICATION(warning, |
| 119 | warning_notification_serialize); |
nothing calls this directly
no test coverage detected