From 0ffb4f8463e3e06e8d88b7be22f5cb7adb702361 Mon Sep 17 00:00:00 2001 From: pk33 Date: Sun, 3 Nov 2024 22:26:28 +0100 Subject: fonts, text and basic ui for on-screen log --- src/logger.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/logger.c') diff --git a/src/logger.c b/src/logger.c index 860311b..d6bf3f9 100644 --- a/src/logger.c +++ b/src/logger.c @@ -10,16 +10,17 @@ #include "logger.h" #include "options.h" +#include "ui33.h" Logger __logger; static char *colours[5] = { - "[\x1b[36mDebug\x1b[37m]", - "[\x1b[32mInfo\x1b[37m]", - "[\x1b[35mWarn\x1b[37m]", - "[\x1b[33mError\x1b[37m]", - "[\x1b[31mFatal\x1b[37m]", + "[\x1b[36mD\x1b[37m]", + "[\x1b[32mI\x1b[37m]", + "[\x1b[35mW\x1b[37m]", + "[\x1b[33mE\x1b[37m]", + "[\x1b[31mFl\x1b[37m]", }; Size logger_init( void ) @@ -43,6 +44,7 @@ Size logger_init( void ) __logger.func = 0; + ui_add_message( "Welcome to Engine33" ); dprintf( __logger.fd, "\033[3J\033[1;1HWelcome to Engine33!\r\n\r\n" ); return E33_EXIT_SUCCESS; @@ -66,7 +68,12 @@ void logger( Size level, const char *fmt, ... ) time(¤tTime); m_time = localtime(¤tTime); - dprintf( __logger.fd, "Engine33 [%02d:%02d:%02d] -", m_time->tm_hour, m_time->tm_min, m_time->tm_sec ); + + ui_add_message( fmt, args ); /* XXX */ + + + dprintf( __logger.fd, "Engine33 [%02d:%02d:%02d] -", + m_time->tm_hour, m_time->tm_min, m_time->tm_sec ); dprintf( __logger.fd, " %s ", colours[level] ); vdprintf(__logger.fd, fmt, args); @@ -75,7 +82,7 @@ void logger( Size level, const char *fmt, ... ) dprintf( __logger.fd, ". Reason: %s", strerror(errno) ); errno = 0; } - + dprintf( __logger.fd, ".\r\n" ); va_end(args); -- cgit v1.2.3