24 #include "strings.hpp" 27 #include <QMutexLocker> 45 d->printToStderr =
true;
54 QString timestampString;
57 timestampString = Strings::timestamp(
"[hh:mm:ss] ");
60 QString entry = timestampString +
string +
"\n";
66 QMutexLocker locker(&d->mutex);
70 fprintf(stderr,
"%s",
string.toUtf8().constData());
73 d->logContent += string;
84 d->logContent.clear();
94 return d->printToStderr;
110 setPrintingToStderr(b);
113 void Log::setPrintingToStderr(
bool b)
115 d->printToStderr = b;
118 void Log::setTimestampsEnabled(
bool b)
bool isPrintingToStderr() const
If true all new entries will also be printed to stderr.
Log & operator<<(const QString &string)
Executes addEntry(const QString&).
void addEntry(const QString &string)
void clearContent()
Clears log content stored in the memory.
const QString & content() const
Entire content of the log.
bool isPrintingToStdout() const
If true all new entries will also be printed to stderr.
void newEntry(const QString &entry)
void setPrintingToStdout(bool b)
bool areTimestampsEnabled() const
Timestamps are in format [hh:mm:ss]. Enabled by default.
void addUnformattedEntry(const QString &string)