/** * 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); #ifdef DUSK_PSP_LOG_FILE // print to file - fopen+fclose every call is real, measured Memory // Stick I/O cost (this is why the flag exists - see psp.cmake). 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); } #endif 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); #ifdef DUSK_PSP_LOG_FILE // print to file - fopen+fclose every call is real, measured Memory // Stick I/O cost (this is why the flag exists - see psp.cmake). 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); } #endif va_end(args); }