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

Function warning_notification_serialize

lightningd/notification.c:103–122  ·  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

101/*'warning' is based on LOG_UNUSUAL/LOG_BROKEN level log
102 *(in plugin module, they're 'warn'/'error' level). */
103static 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
124REGISTER_NOTIFICATION(warning);
125

Callers 1

notify_warningFunction · 0.85

Calls 3

json_add_timestrFunction · 0.85
json_add_timeisoFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected