|
|
@@ -25,22 +25,18 @@ bool opt_log_microseconds;
|
|
|
/* per default priorities higher than LOG_NOTICE are logged */
|
|
|
int opt_log_level = LOG_NOTICE;
|
|
|
|
|
|
-static void my_log_curses(int prio, const char *datetime, const char *str)
|
|
|
+static void _my_log_curses(int prio, const char *datetime, const char *str)
|
|
|
{
|
|
|
if (opt_quiet && prio != LOG_ERR)
|
|
|
return;
|
|
|
|
|
|
#ifdef HAVE_CURSES
|
|
|
extern bool use_curses;
|
|
|
- if (use_curses && log_curses_only(prio, datetime, str))
|
|
|
+ if (use_curses && _log_curses_only(prio, datetime, str))
|
|
|
;
|
|
|
else
|
|
|
#endif
|
|
|
- {
|
|
|
- bfg_console_lock();
|
|
|
printf(" %s %s%s", datetime, str, " \n");
|
|
|
- bfg_console_unlock();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/* high-level logging function, based on global opt_log_level */
|
|
|
@@ -86,15 +82,20 @@ void _applog(int prio, const char *str)
|
|
|
else
|
|
|
get_now_datestamp(datetime);
|
|
|
|
|
|
- /* Only output to stderr if it's not going to the screen as well */
|
|
|
- if (writetofile) {
|
|
|
+ if (writetofile || writetocon)
|
|
|
+ {
|
|
|
bfg_console_lock();
|
|
|
- fprintf(stderr, " %s %s\n", datetime, str); /* atomic write to stderr */
|
|
|
- fflush(stderr);
|
|
|
+
|
|
|
+ /* Only output to stderr if it's not going to the screen as well */
|
|
|
+ if (writetofile) {
|
|
|
+ fprintf(stderr, " %s %s\n", datetime, str); /* atomic write to stderr */
|
|
|
+ fflush(stderr);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (writetocon)
|
|
|
+ _my_log_curses(prio, datetime, str);
|
|
|
+
|
|
|
bfg_console_unlock();
|
|
|
}
|
|
|
-
|
|
|
- if (writetocon)
|
|
|
- my_log_curses(prio, datetime, str);
|
|
|
}
|
|
|
}
|