mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 06:56:21 +00:00
Let user change log level while running
`/log level INFO|DEBUG|WARN|ERROR` is now available. Looks like this solves a TODO (see removed comment in source) from 2013 :-) Works only with default log file. Not with user provided log file during start up via the -f parameter. Fix https://github.com/profanity-im/profanity/issues/1627
This commit is contained in:
@@ -6495,9 +6495,19 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
if (strcmp(subcmd, "level") == 0) {
|
||||
if (g_strcmp0(value, "INFO") == 0 || g_strcmp0(value, "DEBUG") == 0 || g_strcmp0(value, "WARN") == 0 || g_strcmp0(value, "ERROR") == 0) {
|
||||
|
||||
/* TODO: make 'level' subcommand for debug level */
|
||||
log_level_t prof_log_level = log_level_from_string(value);
|
||||
log_close();
|
||||
log_init(prof_log_level, NULL);
|
||||
|
||||
cons_show("Log level changed to: %s.", value);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user