MCPcopy Create free account
hub / github.com/ElementsProject/lightning / warning_notification_serialize

Function warning_notification_serialize

lightningd/notification.c:97–116  ·  view source on GitHub ↗

'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log *(in plugin module, they're 'warn'/'error' level). */

Source from the content-addressed store, hash-verified

95/*'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log
96 *(in plugin module, they're 'warn'/'error' level). */
97static 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
118REGISTER_NOTIFICATION(warning,
119 warning_notification_serialize);

Callers

nothing calls this directly

Calls 5

json_object_startFunction · 0.50
json_add_stringFunction · 0.50
json_add_timeFunction · 0.50
json_add_timeisoFunction · 0.50
json_object_endFunction · 0.50

Tested by

no test coverage detected