Update error and debug logging methods
Build Dusk / run-tests (push) Failing after 14s
Build Dusk / build-linux (push) Failing after 15s
Build Dusk / build-psp (push) Failing after 22s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 15s

This commit is contained in:
2026-03-11 10:33:43 -05:00
parent 1d7516982a
commit d21cd7f78b
30 changed files with 147 additions and 144 deletions
+11
View File
@@ -0,0 +1,11 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DUSK_LIBRARY_TARGET_NAME}
PUBLIC
log.c
)
+52
View File
@@ -0,0 +1,52 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "log/log.h"
void logDebug(const char_t *message, ...) {
va_list args;
va_start(args, message);
// print to stdout
va_list copy;
va_copy(copy, args);
vprintf(message, copy);
va_end(copy);
// print to file
FILE *file = fopen("ms0:/PSP/GAME/Dusk/debug.log", "a");
if (file) {
va_copy(copy, args);
vfprintf(file, message, copy);
va_end(copy);
fclose(file);
}
va_end(args);
}
void logError(const char_t *message, ...) {
va_list args;
va_start(args, message);
// print to stderr
va_list copy;
va_copy(copy, args);
vfprintf(stderr, message, copy);
va_end(copy);
// print to file
FILE *file = fopen("ms0:/PSP/GAME/Dusk/error.log", "a");
if (file) {
va_copy(copy, args);
vfprintf(file, message, copy);
va_end(copy);
fclose(file);
}
va_end(args);
}