allow for log flushing

This commit is contained in:
mrbesen 2023-11-21 19:41:53 +01:00
parent c5274a56b8
commit feac7be191
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
2 changed files with 10 additions and 3 deletions

10
Log.cpp
View File

@ -15,6 +15,13 @@
#include <QString>
#endif
#if LOG_ENABLEFLUSH == 1
#define FLUSH_COMMAND std::endl
#else
// dont flush
#define FLUSH_COMMAND '\n'
#endif
namespace Log {
#if LOG_ENABLEQT == 1
@ -54,8 +61,7 @@ public:
std::ostream* os = getOs(lvl);
if (os) {
*os << sbuf;
os->put('\n');
*os << sbuf << FLUSH_COMMAND;
}
};

View File

@ -2,7 +2,8 @@ TARGET = Log.o
TEST = test
LOG_USEMUTEX ?= 0
LOG_ENABLEQT ?= 0
CXXFLAGS = -O2 -g -std=c++11 -Wall -Wextra -pedantic-errors -MMD -DLOG_USEMUTEX=$(LOG_USEMUTEX) -DLOG_ENABLEQT=$(LOG_ENABLEQT)
LOG_ENABLEFLUSH ?= 0
CXXFLAGS = -O2 -g -std=c++11 -Wall -Wextra -pedantic-errors -MMD -DLOG_USEMUTEX=$(LOG_USEMUTEX) -DLOG_ENABLEQT=$(LOG_ENABLEQT) -DLOG_ENABLEFLUSH=$(LOG_ENABLEFLUSH)
.PHONY: all clean