lightningd: rename command_log() to command_logger()

It doesn't actually log, just gets the `struct logger`, so this name is better.

We're also going to implement command_log() as an actual logging
function in next commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-06-23 00:33:33 +09:30
parent 8288603bab
commit 3531414d18
6 changed files with 12 additions and 12 deletions

View file

@ -1231,7 +1231,7 @@ static struct command_result *json_invoice(struct command *cmd,
req = jsonrpc_request_start(info, "listincoming", req = jsonrpc_request_start(info, "listincoming",
cmd->id, plugin->non_numeric_ids, cmd->id, plugin->non_numeric_ids,
command_log(cmd), command_logger(cmd),
NULL, listincoming_done, NULL, listincoming_done,
info); info);
jsonrpc_request_end(req); jsonrpc_request_end(req);

View file

@ -172,7 +172,7 @@ static void destroy_jcon(struct json_connection *jcon)
tal_free(jcon->log); tal_free(jcon->log);
} }
struct logger *command_log(struct command *cmd) struct logger *command_logger(struct command *cmd)
{ {
if (cmd->jcon) if (cmd->jcon)
return cmd->jcon->log; return cmd->jcon->log;
@ -673,7 +673,7 @@ bool command_deprecated_in_ok(struct command *cmd,
const char *depr_end) const char *depr_end)
{ {
return lightningd_deprecated_in_ok(cmd->ld, return lightningd_deprecated_in_ok(cmd->ld,
command_log(cmd), command_logger(cmd),
command_deprecated_ok_flag(cmd), command_deprecated_ok_flag(cmd),
cmd->json_cmd->name, param, cmd->json_cmd->name, param,
depr_start, depr_end, depr_start, depr_end,

View file

@ -150,7 +150,7 @@ struct command_result *command_raw_complete(struct command *cmd,
struct json_stream *result); struct json_stream *result);
/* Logging point to use for this command (usually, the JSON connection). */ /* Logging point to use for this command (usually, the JSON connection). */
struct logger *command_log(struct command *cmd); struct logger *command_logger(struct command *cmd);
/* To return if param() fails. */ /* To return if param() fails. */
extern struct command_result *command_param_failed(void) extern struct command_result *command_param_failed(void)

View file

@ -2331,7 +2331,7 @@ static void plugin_setconfig_done(const char *buffer,
* while we were in callback, and moved opt_table! */ * while we were in callback, and moved opt_table! */
ot = opt_find_long(psr->optname, NULL); ot = opt_find_long(psr->optname, NULL);
if (!ot) { if (!ot) {
log_broken(command_log(psr->cmd), log_broken(command_logger(psr->cmd),
"Missing opt %s on plugin return?", psr->optname); "Missing opt %s on plugin return?", psr->optname);
was_pending(command_fail(psr->cmd, LIGHTNINGD, was_pending(command_fail(psr->cmd, LIGHTNINGD,
"Missing opt %s on plugin return?", psr->optname)); "Missing opt %s on plugin return?", psr->optname));
@ -2345,7 +2345,7 @@ static void plugin_setconfig_done(const char *buffer,
return; return;
bad_response: bad_response:
log_broken(command_log(psr->cmd), log_broken(command_logger(psr->cmd),
"Invalid setconfig %s response from plugin: %.*s", "Invalid setconfig %s response from plugin: %.*s",
psr->optname, psr->optname,
json_tok_full_len(toks), json_tok_full(buffer, toks)); json_tok_full_len(toks), json_tok_full(buffer, toks));
@ -2385,7 +2385,7 @@ struct command_result *plugin_set_dynamic_opt(struct command *cmd,
req = jsonrpc_request_start(cmd, "check", req = jsonrpc_request_start(cmd, "check",
cmd->id, cmd->id,
plugin->non_numeric_ids, plugin->non_numeric_ids,
command_log(cmd), command_logger(cmd),
NULL, plugin_setconfig_done, NULL, plugin_setconfig_done,
psr); psr);
json_add_string(req->stream, "command_to_check", "setconfig"); json_add_string(req->stream, "command_to_check", "setconfig");
@ -2393,7 +2393,7 @@ struct command_result *plugin_set_dynamic_opt(struct command *cmd,
req = jsonrpc_request_start(cmd, "setconfig", req = jsonrpc_request_start(cmd, "setconfig",
cmd->id, cmd->id,
plugin->non_numeric_ids, plugin->non_numeric_ids,
command_log(cmd), command_logger(cmd),
NULL, plugin_setconfig_done, NULL, plugin_setconfig_done,
psr); psr);
} }

View file

@ -223,7 +223,7 @@ static struct command_result *json_checkmessage(struct command *cmd,
req = jsonrpc_request_start(cmd, "listnodes", req = jsonrpc_request_start(cmd, "listnodes",
cmd->id, cmd->id,
plugin->non_numeric_ids, plugin->non_numeric_ids,
command_log(cmd), command_logger(cmd),
NULL, listnodes_done, NULL, listnodes_done,
can); can);
json_add_node_id(req->stream, "id", &can->id); json_add_node_id(req->stream, "id", &can->id);

View file

@ -169,9 +169,9 @@ struct command_result *command_failed(struct command *cmd UNNEEDED,
/* Generated stub for command_its_complicated */ /* Generated stub for command_its_complicated */
struct command_result *command_its_complicated(const char *why UNNEEDED) struct command_result *command_its_complicated(const char *why UNNEEDED)
{ fprintf(stderr, "command_its_complicated called!\n"); abort(); } { fprintf(stderr, "command_its_complicated called!\n"); abort(); }
/* Generated stub for command_log */ /* Generated stub for command_logger */
struct logger *command_log(struct command *cmd UNNEEDED) struct logger *command_logger(struct command *cmd UNNEEDED)
{ fprintf(stderr, "command_log called!\n"); abort(); } { fprintf(stderr, "command_logger called!\n"); abort(); }
/* Generated stub for command_param_failed */ /* Generated stub for command_param_failed */
struct command_result *command_param_failed(void) struct command_result *command_param_failed(void)