aboutsummaryrefslogtreecommitdiff
path: root/src/logger.c
diff options
context:
space:
mode:
authorpk33 <pk33@pk33.space>2024-11-03 22:26:28 +0100
committerpk33 <pk33@pk33.space>2024-11-03 22:26:28 +0100
commit0ffb4f8463e3e06e8d88b7be22f5cb7adb702361 (patch)
tree05e626d6ce4e0d8e544a40f8a14965cf4fdd5780 /src/logger.c
parent6c69ea8da9d306e4e6d21d0feee5213fea15f49e (diff)
downloadengine33-0ffb4f8463e3e06e8d88b7be22f5cb7adb702361.tar.gz
fonts, text and basic ui for on-screen log
Diffstat (limited to 'src/logger.c')
-rw-r--r--src/logger.c21
1 files changed, 14 insertions, 7 deletions
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(&currentTime);
m_time = localtime(&currentTime);
- 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);