#include <log.h>
Public Slots | |
void | addEntry (const QString &string) |
void | addUnformattedEntry (const QString &string) |
void | clearContent () |
Clears log content stored in the memory. | |
Signals | |
void | newEntry (const QString &entry) |
Public Member Functions | |
bool | areTimestampsEnabled () const |
const QString & | content () const |
void | logPrintf (const char *str,...) |
void | logUnformattedPrintf (const char *str,...) |
bool | isPrintingToStdout () const |
void | setPrintingToStdout (bool b) |
void | setTimestampsEnabled (bool b) |
Log & | operator<< (const QString &string) |
Executes addEntry(const QString&). | |
Static Public Attributes | |
static Log | instance |
Global instance of the logger. | |
Protected Member Functions | |
int | doLogPrintf (char *output, unsigned outputSize, const char *str, va_list argList) |
Protected Attributes | |
QString | logContent |
Entire content of the log. | |
QMutex | thisMutex |
bool | printToStdout |
bool | timestamps |
Timestamps are in format [hh:mm:ss]. Enabled by default. |
Log manager.
void Log::addEntry | ( | const QString & | string | ) | [slot] |
Prints the string to specified output and appends a '\n' character to the end of that string. Additional formatting is also applied if certain flags are enabled.
void Log::addUnformattedEntry | ( | const QString & | string | ) | [slot] |
Prints the string to specified output AS IT IS.
void Log::logPrintf | ( | const char * | str, |
... | |||
) |
Works like printf() from stdio. After the output string is constructed it is passed to addEntry() where additional formatting is applied.
void Log::logUnformattedPrintf | ( | const char * | str, |
... | |||
) |
Works like printf() from stdio. After the output string is constructed it is displayed AS IS, without any additional formatting.
void Log::newEntry | ( | const QString & | entry | ) | [signal] |
Sends out an already formatted new entry. Please note that there are no additional newline character appended to the entry string. This is emitted by addEntry() and addUnformattedEntry() slots.
bool Log::printToStdout [protected] |
If true all new entries will also be printed to stdout. Otherwise entries are stored only in the logContent member. Default is true.