mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
lightningd: use jcon logging for commands where possible.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
caecd1ee0a
commit
bbe1711e16
@ -1251,7 +1251,7 @@ static struct command_result *json_invoice(struct command *cmd,
|
||||
|
||||
req = jsonrpc_request_start(info, "listincoming",
|
||||
cmd->id,
|
||||
cmd->ld->log,
|
||||
command_log(cmd),
|
||||
NULL, listincoming_done,
|
||||
info);
|
||||
jsonrpc_request_end(req);
|
||||
|
@ -145,6 +145,13 @@ static void destroy_jcon(struct json_connection *jcon)
|
||||
tal_free(jcon->log);
|
||||
}
|
||||
|
||||
struct log *command_log(struct command *cmd)
|
||||
{
|
||||
if (cmd->jcon)
|
||||
return cmd->jcon->log;
|
||||
return cmd->ld->log;
|
||||
}
|
||||
|
||||
static struct command_result *json_help(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
|
@ -138,6 +138,9 @@ void json_stream_log_suppress_for_cmd(struct json_stream *js,
|
||||
struct command_result *command_raw_complete(struct command *cmd,
|
||||
struct json_stream *result);
|
||||
|
||||
/* Logging point to use for this command (usually, the JSON connection). */
|
||||
struct log *command_log(struct command *cmd);
|
||||
|
||||
/* To return if param() fails. */
|
||||
extern struct command_result *command_param_failed(void)
|
||||
WARN_UNUSED_RESULT;
|
||||
|
@ -213,7 +213,7 @@ static struct command_result *json_checkmessage(struct command *cmd,
|
||||
can->cmd = cmd;
|
||||
req = jsonrpc_request_start(cmd, "listnodes",
|
||||
cmd->id,
|
||||
cmd->ld->log,
|
||||
command_log(cmd),
|
||||
NULL, listnodes_done,
|
||||
can);
|
||||
json_add_node_id(req->stream, "id", &can->id);
|
||||
|
@ -136,6 +136,9 @@ struct command_result *command_failed(struct command *cmd UNNEEDED,
|
||||
/* Generated stub for command_its_complicated */
|
||||
struct command_result *command_its_complicated(const char *why UNNEEDED)
|
||||
{ fprintf(stderr, "command_its_complicated called!\n"); abort(); }
|
||||
/* Generated stub for command_log */
|
||||
struct log *command_log(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "command_log called!\n"); abort(); }
|
||||
/* Generated stub for command_param_failed */
|
||||
struct command_result *command_param_failed(void)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user