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

Function json_notify_fmt

lightningd/jsonrpc.c:527–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527void json_notify_fmt(struct command *cmd,
528 enum log_level level,
529 const char *fmt, ...)
530{
531 va_list ap;
532 struct json_stream *js;
533
534 if (!cmd->send_notifications)
535 return;
536
537 js = json_stream_raw_for_cmd(cmd);
538
539 va_start(ap, fmt);
540 json_object_start(js, NULL);
541 json_add_string(js, "jsonrpc", "2.0");
542 json_add_string(js, "method", "message");
543 json_object_start(js, "params");
544 if (cmd->id_is_string)
545 json_add_string(js, "id", cmd->id);
546 else
547 json_add_jsonstr(js, "id", cmd->id, strlen(cmd->id));
548 json_add_string(js, "level", log_level_name(level));
549 json_add_string(js, "message", tal_vfmt(tmpctx, fmt, ap));
550 json_object_end(js);
551 json_object_end(js);
552
553 json_stream_double_cr(js);
554 json_stream_flush(js);
555}
556
557struct json_stream *json_stream_raw_for_cmd(struct command *cmd)
558{

Callers 3

close_command_timeoutFunction · 0.85
register_close_commandFunction · 0.85
peer_closing_notifyFunction · 0.85

Calls 8

json_stream_raw_for_cmdFunction · 0.85
json_add_jsonstrFunction · 0.85
json_stream_double_crFunction · 0.85
json_stream_flushFunction · 0.85
json_object_startFunction · 0.50
json_add_stringFunction · 0.50
log_level_nameFunction · 0.50
json_object_endFunction · 0.50

Tested by

no test coverage detected