log: Introduced stderr log handler
This handler redirects stderr output to a pipe and gathers logs from the read end. The handler is called from main loop, therefore, if a function prints logs to stderr they will be put to log file only after function returns.
This commit is contained in:
@@ -89,6 +89,7 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
|
||||
|
||||
char *line = NULL;
|
||||
while(cont) {
|
||||
log_stderr_handler();
|
||||
_check_autoaway();
|
||||
|
||||
line = ui_readline();
|
||||
@@ -225,6 +226,7 @@ _init(const int disable_tls, char *log_level)
|
||||
log_level_t prof_log_level = log_level_from_string(log_level);
|
||||
prefs_load();
|
||||
log_init(prof_log_level);
|
||||
log_stderr_init(PROF_LEVEL_ERROR);
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
log_info("Starting Profanity (%sdev.%s.%s)...", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
|
||||
@@ -283,6 +285,7 @@ _shutdown(void)
|
||||
theme_close();
|
||||
accounts_close();
|
||||
cmd_uninit();
|
||||
log_stderr_close();
|
||||
log_close();
|
||||
prefs_close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user