fix: "Atomic" output log messages on minimial boot env, debug
Fully format log messages and call OutputDebugStringA only once. This avoids getting split log messages on concurrent calls to OutputDebugStringA.
This commit is contained in:
@@ -12,9 +12,7 @@
|
||||
|
||||
#include "util/str.h"
|
||||
|
||||
#define CORE_BOOT_LOG_MODULE_SIZE_MAX 128
|
||||
/* 64k so we can log data dumps of rs232 without crashing */
|
||||
#define CORE_BOOT_LOG_MSG_SIZE_MAX 65536
|
||||
#define CORE_BOOT_LOG_MSG_SIZE_MAX 8192
|
||||
|
||||
static void _core_boot_log_std_msg(const char *module, const char *fmt, ...)
|
||||
{
|
||||
@@ -31,19 +29,19 @@ static void _core_boot_log_std_msg(const char *module, const char *fmt, ...)
|
||||
|
||||
static void _core_boot_log_debug_msg(const char *module, const char *fmt, ...)
|
||||
{
|
||||
char module_str[CORE_BOOT_LOG_MODULE_SIZE_MAX];
|
||||
char msg[CORE_BOOT_LOG_MSG_SIZE_MAX];
|
||||
char msg2[CORE_BOOT_LOG_MSG_SIZE_MAX];
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
str_format(module_str, sizeof(module_str), "[%s] ", module);
|
||||
str_vformat(msg, sizeof(msg), fmt, args);
|
||||
OutputDebugStringA(module_str);
|
||||
OutputDebugStringA(msg);
|
||||
OutputDebugStringA("\n");
|
||||
|
||||
va_end(args);
|
||||
|
||||
str_format(msg2, sizeof(msg2), "[%s] %s\n", module, msg);
|
||||
|
||||
OutputDebugStringA(msg2);
|
||||
}
|
||||
|
||||
static void _core_boot_minimal_logging_std_env_init()
|
||||
|
||||
@@ -20,6 +20,7 @@ libs_launcher := \
|
||||
iface \
|
||||
module \
|
||||
core \
|
||||
mxml \
|
||||
|
||||
src_launcher := \
|
||||
app.c \
|
||||
|
||||
Reference in New Issue
Block a user