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

Function json_getlog

lightningd/log.c:1257–1279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1255}
1256
1257static struct command_result *json_getlog(struct command *cmd,
1258 const char *buffer,
1259 const jsmntok_t *obj UNNEEDED,
1260 const jsmntok_t * params)
1261{
1262 struct json_stream *response;
1263 enum log_level *minlevel;
1264 struct log_book *log_book = cmd->ld->log_book;
1265
1266 if (!param(cmd, buffer, params,
1267 p_opt_def("level", param_getloglevel, &minlevel, LOG_INFORM),
1268 NULL))
1269 return command_param_failed();
1270
1271 response = json_stream_success(cmd);
1272 /* Suppress logging for this stream, to not bloat io logs */
1273 json_stream_log_suppress_for_cmd(response, cmd);
1274 json_add_timestr(response, "created_at", log_book->init_time.ts);
1275 json_add_num(response, "bytes_used", (unsigned int)ringbuf_used(log_book));
1276 json_add_num(response, "bytes_max", sizeof(log_book->ringbuf));
1277 json_add_log(response, log_book, NULL, *minlevel);
1278 return command_success(cmd, response);
1279}
1280
1281static const struct json_command getlog_command = {
1282 "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