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:
Rusty Russell
2024-06-23 00:34:33 +09:30
parent 3531414d18
commit e0e38c2cd5
3 changed files with 33 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
#include <ccan/compiler/compiler.h>
#include <common/json_parse.h>
#include <common/jsonrpc_errors.h>
#include <common/status_levels.h>
struct command;
struct command_result;
@@ -33,6 +34,11 @@ command_fail_badparam(struct command *cmd,
json_tok_full(buffer, tok));
}
/* Do some logging (complaining!) about this command misuse */
void command_log(struct command *cmd, enum log_level level,
const char *fmt, ...)
PRINTF_FMT(3, 4);
/* Also caller supplied: is this invoked simply to get usage? */
bool command_usage_only(const struct command *cmd);