core-lightning/common/subdaemon.c
Rusty Russell 73415d35c9 common: don't send trace messages by default, don't ratelimit at all.
We ratelimited DEBUG messages, but that can be annoying and cause us to miss things.
We demoted the worst offenders in the last release, to TRACE level.

Now, only log trace if it's wanted, and never suppress DEBUG.

Changelog-Changed: Logging: we no longer suppress DEBUG messages from subdaemons.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: https://github.com/ElementsProject/lightning/issues/7917
2024-12-16 09:48:51 +10:30

40 lines
828 B
C

#include "config.h"
#include <common/status.h>
#include <common/subdaemon.h>
#include <common/version.h>
#include <stdio.h>
static void status_backtrace_print(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
status_vfmt(LOG_BROKEN, NULL, fmt, ap);
va_end(ap);
}
static void status_backtrace_exit(void)
{
status_failed(STATUS_FAIL_INTERNAL_ERROR, "FATAL SIGNAL");
}
bool subdaemon_setup(int argc, char *argv[])
{
bool developer;
if (argc == 2 && streq(argv[1], "--version")) {
printf("%s\n", version());
exit(0);
}
for (int i = 1; i < argc; i++) {
if (streq(argv[i], "--log-io"))
logging_io = true;
if (streq(argv[i], "--log-trace"))
logging_trace = true;
}
developer = daemon_developer_mode(argv);
daemon_setup(argv[0], status_backtrace_print, status_backtrace_exit);
return developer;
}