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

Function opt_log_level

lightningd/log.c:827–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825}
826
827char *opt_log_level(const char *arg, struct log_book *log_book)
828{
829 enum log_level level;
830 int len;
831
832 len = strcspn(arg, ":");
833 if (!log_level_parse(arg, len, &level))
834 return tal_fmt(tmpctx, "unknown log level %.*s", len, arg);
835
836 if (arg[len]) {
837 struct print_filter *f = tal(log_book, struct print_filter);
838 f->prefix = arg + len + 1;
839 f->level = level;
840
841 /* :<filename> */
842 len = strcspn(f->prefix, ":");
843 if (f->prefix[len]) {
844 struct log_file *lf;
845 lf = find_log_file(log_book, f->prefix + len + 1);
846 if (!lf)
847 return tal_fmt(tmpctx,
848 "unknown log file %s",
849 f->prefix + len + 1);
850 f->prefix = tal_strndup(f, f->prefix, len);
851 list_add_tail(&lf->print_filters, &f->list);
852 } else {
853 list_add_tail(&log_book->print_filters, &f->list);
854 }
855 } else {
856 tal_free(log_book->default_print_level);
857 log_book->default_print_level = tal(log_book, enum log_level);
858 *log_book->default_print_level = level;
859 }
860 return NULL;
861}
862
863void json_add_opt_log_levels(struct json_stream *response, struct log_book *log_book)
864{

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