MCPcopy Create free account
hub / github.com/ElementsProject/lightning / opt_log_level

Function opt_log_level

lightningd/log.c:840–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838}
839
840char *opt_log_level(const char *arg, struct log_book *log_book)
841{
842 enum log_level level;
843 int len;
844
845 len = strcspn(arg, ":");
846 if (!log_level_parse(arg, len, &level))
847 return tal_fmt(tmpctx, "unknown log level %.*s", len, arg);
848
849 if (arg[len]) {
850 struct print_filter *f = tal(log_book, struct print_filter);
851 f->prefix = arg + len + 1;
852 f->level = level;
853
854 /* :<filename> */
855 len = strcspn(f->prefix, ":");
856 if (f->prefix[len]) {
857 struct log_file *lf;
858 lf = find_log_file(log_book, f->prefix + len + 1);
859 if (!lf)
860 return tal_fmt(tmpctx,
861 "unknown log file %s",
862 f->prefix + len + 1);
863 f->prefix = tal_strndup(f, f->prefix, len);
864 list_add_tail(&lf->print_filters, &f->list);
865 } else {
866 list_add_tail(&log_book->print_filters, &f->list);
867 }
868 } else {
869 tal_free(log_book->default_print_level);
870 log_book->default_print_level = tal(log_book, enum log_level);
871 *log_book->default_print_level = level;
872 }
873 return NULL;
874}
875
876void json_add_opt_log_levels(struct json_stream *response, struct log_book *log_book)
877{

Callers 1

mainFunction · 0.85

Calls 3

log_level_parseFunction · 0.85
find_log_fileFunction · 0.85
tal_freeFunction · 0.85

Tested by 1

mainFunction · 0.68