Add log framework

This commit is contained in:
2026-04-24 15:14:15 +02:00
parent 78899f32a6
commit 0e826e05e1
5 changed files with 62 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "test.h"
#include "log.h"
#include <string.h>
static char s_lastLoggedError[256];
static void mock_log(const char* msg) {
strncpy(s_lastLoggedError, msg, sizeof(s_lastLoggedError) - 1);
s_lastLoggedError[sizeof(s_lastLoggedError) - 1] = '\0';
}
static void test_log_error(void) {
log_set_output(mock_log);
memset(s_lastLoggedError, 0, sizeof(s_lastLoggedError));
log_error("test error message");
assert_str("test error message", s_lastLoggedError, "expected 'test error message'");
log_set_output(NULL); // Reset to default
}