common: new function command_log to log something about a specific command.
Needs implementations for lightningd and libplugin, since they both use this infrastructure. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -631,6 +631,19 @@ bool command_check_only(const struct command *cmd)
|
||||
return cmd->check;
|
||||
}
|
||||
|
||||
void command_log(struct command *cmd, enum log_level level,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
const char *msg;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
msg = tal_vfmt(cmd, fmt, ap);
|
||||
plugin_log(cmd->plugin, level, "JSON COMMAND %s: %s",
|
||||
cmd->methodname, msg);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
struct command_result *command_check_done(struct command *cmd)
|
||||
{
|
||||
assert(command_check_only(cmd));
|
||||
|
||||
Reference in New Issue
Block a user