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

Function json_notify_fmt

lightningd/jsonrpc.c:652–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652void json_notify_fmt(struct command *cmd,
653 enum log_level level,
654 const char *fmt, ...)
655{
656 va_list ap;
657 struct json_stream *js;
658 const char *msg;
659
660 va_start(ap, fmt);
661 msg = tal_vfmt(tmpctx, fmt, ap);
662 va_end(ap);
663
664 /* Help for tests */
665 log_debug(cmd->ld->log, "NOTIFY %s %s %s",
666 cmd->id, log_level_name(level), msg);
667 if (!cmd->send_notifications)
668 return;
669
670 js = json_stream_raw_for_cmd(cmd);
671
672 json_object_start(js, NULL);
673 json_add_string(js, "jsonrpc", "2.0");
674 json_add_string(js, "method", "message");
675 json_object_start(js, "params");
676 json_add_id(js, cmd->id);
677 json_add_string(js, "level", log_level_name(level));
678 json_add_string(js, "message", msg);
679 json_object_end(js);
680 json_object_end(js);
681
682 json_stream_double_cr(js);
683 json_stream_flush(js);
684}
685
686struct json_stream *json_stream_raw_for_cmd(struct command *cmd)
687{

Callers 7

json_openchannel_bumpFunction · 0.70
json_openchannel_initFunction · 0.70
close_command_timeoutFunction · 0.70
register_close_commandFunction · 0.70
peer_closing_notifyFunction · 0.70
json_fundchannel_startFunction · 0.70

Calls 8

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

Tested by

no test coverage detected