mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
plugins: make log prefix the basename.
It's not perfect if they have multiple with same name, but better than number. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
aa4284a35e
commit
111d6df442
@ -118,18 +118,14 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
|||||||
void plugin_register(struct plugins *plugins, const char* path TAKES)
|
void plugin_register(struct plugins *plugins, const char* path TAKES)
|
||||||
{
|
{
|
||||||
struct plugin *p;
|
struct plugin *p;
|
||||||
static size_t plugin_count = 0;
|
|
||||||
p = tal(plugins, struct plugin);
|
p = tal(plugins, struct plugin);
|
||||||
list_add_tail(&plugins->plugins, &p->list);
|
list_add_tail(&plugins->plugins, &p->list);
|
||||||
p->plugins = plugins;
|
p->plugins = plugins;
|
||||||
p->cmd = tal_strdup(p, path);
|
p->cmd = tal_strdup(p, path);
|
||||||
p->outbuf = NULL;
|
p->outbuf = NULL;
|
||||||
|
|
||||||
/* FIXME(cdecker): Referring to plugin by their registration
|
p->log = new_log(p, plugins->log_book, "plugin-%s",
|
||||||
number might not be that useful, come up with a naming scheme
|
path_basename(tmpctx, p->cmd));
|
||||||
that makes more sense. */
|
|
||||||
plugin_count++;
|
|
||||||
p->log = new_log(p, plugins->log_book, "plugin-%zu", plugin_count);
|
|
||||||
p->methods = tal_arr(p, const char *, 0);
|
p->methods = tal_arr(p, const char *, 0);
|
||||||
list_head_init(&p->plugin_opts);
|
list_head_init(&p->plugin_opts);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user