aboutsummaryrefslogtreecommitdiffstats
path: root/core/logging.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-07-01 06:07:11 -0700
committerChris Robinson <[email protected]>2023-07-01 06:07:11 -0700
commit548f7ad80abc253a38171b7e4eb1c84a6b179a41 (patch)
treec21cf749ac11cb4a9bd90861f426716a3ed100da /core/logging.cpp
parent0cad3f7391959d1ad83f948df37db608e3f0e72c (diff)
Don't pass the file handle to al_print
Diffstat (limited to 'core/logging.cpp')
-rw-r--r--core/logging.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/logging.cpp b/core/logging.cpp
index 34385cf4..b6248514 100644
--- a/core/logging.cpp
+++ b/core/logging.cpp
@@ -19,7 +19,16 @@
#include <android/log.h>
#endif
-void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
+
+FILE *gLogFile{stderr};
+#ifdef _DEBUG
+LogLevel gLogLevel{LogLevel::Warning};
+#else
+LogLevel gLogLevel{LogLevel::Error};
+#endif
+
+
+void al_print(LogLevel level, const char *fmt, ...)
{
/* Kind of ugly since string literals are const char arrays with a size
* that includes the null terminator, which we want to exclude from the
@@ -60,6 +69,7 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
if(gLogLevel >= level)
{
+ auto logfile = gLogFile;
fputs(str, logfile);
fflush(logfile);
}