Skip to content

Commit

Permalink
logs: Don't create logs on non debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
joel16 committed Nov 22, 2024
1 parent ba3d5e0 commit 32ba683
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion source/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ namespace GUI {
guiSizeBuf = C2D_TextBufNew(4096);

Textures::Init();
#if defined BUILD_DEBUG
Log::Open();

#endif
// Real time services
#if !defined BUILD_CITRA
mcuHwcInit();
Expand All @@ -81,7 +82,9 @@ namespace GUI {
#if !defined BUILD_CITRA
mcuHwcExit();
#endif
#if defined BUILD_DEBUG
Log::Close();
#endif
Textures::Exit();
C2D_TextBufDelete(guiSizeBuf);
C2D_TextBufDelete(guiDynamicBuf);
Expand Down
9 changes: 7 additions & 2 deletions source/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Log {
static FS_Archive sdmcArchive;
static Handle handle;
static Handle handle = 0;
static u64 offset = 0;

Result Open(void) {
Expand Down Expand Up @@ -44,7 +44,12 @@ namespace Log {
return 0;
}

void Error(const char *data, ...) {
void Error(const char *data, ...) {
// File handle was not open for writing
if (!handle) {
return;
}

char buf[256];
va_list args;
va_start(args, data);
Expand Down

0 comments on commit 32ba683

Please sign in to comment.