logs: Don't create logs on non debug builds

This commit is contained in:
Joel16 2024-11-22 11:30:38 +00:00
parent ba3d5e0529
commit 32ba683bfb
2 changed files with 11 additions and 3 deletions

View File

@ -61,8 +61,9 @@ namespace GUI {
guiSizeBuf = C2D_TextBufNew(4096); guiSizeBuf = C2D_TextBufNew(4096);
Textures::Init(); Textures::Init();
#if defined BUILD_DEBUG
Log::Open(); Log::Open();
#endif
// Real time services // Real time services
#if !defined BUILD_CITRA #if !defined BUILD_CITRA
mcuHwcInit(); mcuHwcInit();
@ -81,7 +82,9 @@ namespace GUI {
#if !defined BUILD_CITRA #if !defined BUILD_CITRA
mcuHwcExit(); mcuHwcExit();
#endif #endif
#if defined BUILD_DEBUG
Log::Close(); Log::Close();
#endif
Textures::Exit(); Textures::Exit();
C2D_TextBufDelete(guiSizeBuf); C2D_TextBufDelete(guiSizeBuf);
C2D_TextBufDelete(guiDynamicBuf); C2D_TextBufDelete(guiDynamicBuf);

View File

@ -6,7 +6,7 @@
namespace Log { namespace Log {
static FS_Archive sdmcArchive; static FS_Archive sdmcArchive;
static Handle handle; static Handle handle = 0;
static u64 offset = 0; static u64 offset = 0;
Result Open(void) { Result Open(void) {
@ -45,6 +45,11 @@ namespace Log {
} }
void Error(const char *data, ...) { void Error(const char *data, ...) {
// File handle was not open for writing
if (!handle) {
return;
}
char buf[256]; char buf[256];
va_list args; va_list args;
va_start(args, data); va_start(args, data);