commit eb0ff40a14d301480672f4e893fe760752a4ad6a
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Mon Feb 21 15:07:34 2022 -0700
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Mon Feb 21 15:07:34 2022 -0700
add option for logger to print to console
---
source/logger.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/source/logger.cpp b/source/logger.cpp
index f63ac54..c88c67c 100644
--- a/source/logger.cpp
+++ b/source/logger.cpp
@@ -5,6 +5,7 @@
#include "logger.h"
#define LOGGER_ENABLED false
+#define PRINT_TO_CONSOLE false
FILE * m_file = nullptr;
bool m_enabled = false;
@@ -33,6 +34,11 @@ void Logger_LogOutput(const char * func, size_t line, const char * format, ...)
fprintf(m_file, "\n\n");
fflush(m_file);
+
+ #if PRINT_TO_CONSOLE
+ vfprintf(stdout, format, args);
+ #endif
+
#endif
}
@@ -48,6 +54,10 @@ void Logger_Write(const char * format, ...)
vfprintf(m_file, format, args);
fflush(m_file);
+
+ #if PRINT_TO_CONSOLE
+ vfprintf(stdout, format, args);
+ #endif
#endif
}
@@ -60,6 +70,10 @@ void Logger_WriteUnformatted(const char * message)
fprintf(m_file, "%s", message);
fflush(m_file);
+
+ #if PRINT_TO_CONSOLE
+ fprintf(stdout, "%s", message);
+ #endif
#endif
}