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

Function json_getlog

lightningd/log.c:1220–1242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220static struct command_result *json_getlog(struct command *cmd,
1221 const char *buffer,
1222 const jsmntok_t *obj UNNEEDED,
1223 const jsmntok_t * params)
1224{
1225 struct json_stream *response;
1226 enum log_level *minlevel;
1227 struct log_book *log_book = cmd->ld->log_book;
1228
1229 if (!param(cmd, buffer, params,
1230 p_opt_def("level", param_loglevel, &minlevel, LOG_INFORM),
1231 NULL))
1232 return command_param_failed();
1233
1234 response = json_stream_success(cmd);
1235 /* Suppress logging for this stream, to not bloat io logs */
1236 json_stream_log_suppress_for_cmd(response, cmd);
1237 json_add_timestr(response, "created_at", log_book->init_time.ts);
1238 json_add_num(response, "bytes_used", (unsigned int)ringbuf_used(log_book));
1239 json_add_num(response, "bytes_max", sizeof(log_book->ringbuf));
1240 json_add_log(response, log_book, NULL, *minlevel);
1241 return command_success(cmd, response);
1242}
1243
1244static const struct json_command getlog_command = {
1245 "getlog",

Callers

nothing calls this directly

Calls 9

json_add_timestrFunction · 0.85
json_add_numFunction · 0.85
ringbuf_usedFunction · 0.85
command_param_failedFunction · 0.70
json_stream_successFunction · 0.70
json_add_logFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected