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

Function json_getlog

lightningd/log.c:963–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963static struct command_result *json_getlog(struct command *cmd,
964 const char *buffer,
965 const jsmntok_t *obj UNNEEDED,
966 const jsmntok_t * params)
967{
968 struct json_stream *response;
969 enum log_level *minlevel;
970 struct log_book *lr = cmd->ld->log_book;
971
972 if (!param(cmd, buffer, params,
973 p_opt_def("level", param_loglevel, &minlevel, LOG_INFORM),
974 NULL))
975 return command_param_failed();
976
977 response = json_stream_success(cmd);
978 /* Suppress logging for this stream, to not bloat io logs */
979 json_stream_log_suppress_for_cmd(response, cmd);
980 json_add_time(response, "created_at", lr->init_time.ts);
981 json_add_num(response, "bytes_used", (unsigned int)lr->mem_used);
982 json_add_num(response, "bytes_max", (unsigned int)lr->max_mem);
983 json_add_log(response, lr, NULL, *minlevel);
984 return command_success(cmd, response);
985}
986
987static const struct json_command getlog_command = {
988 "getlog",

Callers

nothing calls this directly

Calls 8

command_param_failedFunction · 0.70
json_stream_successFunction · 0.70
json_add_logFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50
json_add_timeFunction · 0.50
json_add_numFunction · 0.50

Tested by

no test coverage detected