diff options
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/curses/ui.c | 12 | ||||
| -rw-r--r-- | ui/curses/ui_vars.py | 2 | ||||
| -rw-r--r-- | ui/daemon/ui.c | 26 | ||||
| -rw-r--r-- | ui/daemon/ui_vars.py | 2 |
4 files changed, 34 insertions, 8 deletions
diff --git a/ui/curses/ui.c b/ui/curses/ui.c index faf1b6e..8a2d85a 100644 --- a/ui/curses/ui.c +++ b/ui/curses/ui.c @@ -344,7 +344,7 @@ void ui_line(bool clear, int line, int color, int attr, const char *format, ...) va_start(args, format); vsnprintf(g_line_buff, COLS, format, args); - mvprintw(line, 1, g_line_buff); + mvprintw(line, 1, "%s", g_line_buff); va_end(args); attroff(COLOR_PAIR(color) | attr); @@ -369,7 +369,7 @@ void ui_field(int line, int col, int color, int attr, const char *format, ...) { va_start(args, format); vsnprintf(g_line_buff, COLS - col, format, args); - mvprintw(line, col, g_line_buff); + mvprintw(line, col, "%s", g_line_buff); va_end(args); attroff(COLOR_PAIR(color) | attr); @@ -834,7 +834,7 @@ void ui_print_log_line(unsigned lptr, int line) { PANE_WIDTH, PAIR_NORMAL, A_NORMAL, - " %d-%02d-%02d %02d:%02d:%02d", + " %d-%02d-%02d %02d:%02d:%02d --", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, @@ -845,15 +845,15 @@ void ui_print_log_line(unsigned lptr, int line) { ui_field( line, - PANE_WIDTH + 22, + PANE_WIDTH + 25, g_log_warns[lptr] ? PAIR_WARN : PAIR_HEADER, A_NORMAL, - g_log_warns[lptr] ? "[WARN]" : "[INFO]" + g_log_warns[lptr] ? "WARN" : "INFO" ); ui_field( line, - PANE_WIDTH + 29, + PANE_WIDTH + 30, PAIR_NORMAL, A_NORMAL, g_logs[lptr] diff --git a/ui/curses/ui_vars.py b/ui/curses/ui_vars.py index 54f62e3..b2462fb 100644 --- a/ui/curses/ui_vars.py +++ b/ui/curses/ui_vars.py @@ -1,5 +1,7 @@ class UIVars: def __init__(self, _): + self.flags = set() self.includes = {"curses.h", "locale.h", "time.h"} self.defines = {"-DNCURSES_WIDECHAR=1"} self.links = {"-lncurses"} + self.pager = True diff --git a/ui/daemon/ui.c b/ui/daemon/ui.c index 1f6c35c..28bade9 100644 --- a/ui/daemon/ui.c +++ b/ui/daemon/ui.c @@ -3,7 +3,18 @@ uint64_t g_step_block; void info_impl(const char *restrict fmt, ...) { assert(fmt); - printf("\033[1;34m[INFO]\033[0m "); + + time_t t = time(NULL); + struct tm tm = *localtime(&t); + printf( + "\r%d-%02d-%02d %02d:%02d:%02d -- \033[1;34mINFO\033[0m ", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec + ); va_list args; va_start(args, fmt); @@ -15,7 +26,18 @@ void info_impl(const char *restrict fmt, ...) { void warn_impl(const char *restrict fmt, ...) { assert(fmt); - printf("\033[1;33m[WARN]\033[0m "); + + time_t t = time(NULL); + struct tm tm = *localtime(&t); + printf( + "\r%d-%02d-%02d %02d:%02d:%02d -- \033[1;33mWARN\033[0m ", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec + ); va_list args; va_start(args, fmt); diff --git a/ui/daemon/ui_vars.py b/ui/daemon/ui_vars.py index 5b3d372..f486703 100644 --- a/ui/daemon/ui_vars.py +++ b/ui/daemon/ui_vars.py @@ -1,5 +1,7 @@ class UIVars: def __init__(self, _): + self.flags = set() self.includes = {"signal.h", "stdio.h", "unistd.h"} self.defines = set() self.links = set() + self.pager = False |
