Exemple #1
0
//! creates the complete log message and passes it to the logger
void Logger::Helper::writeToLog()
{
    const char* const levelName = LevelToText(level);
    const QString completeMessage(QString("%1 %2 %3")
                                  .arg(levelName)
                                  .arg(QDateTime::currentDateTime().toString(fmtDateTime))
                                  .arg(buffer)
                                  );

    Logger::instance().enqueueWrite(completeMessage, level);
}
Exemple #2
0
    //! creates the complete log message and passes it to the logger
    void Logger::Helper::writeToLog(){
        const char* const levelName = LevelToText(level);
        const QString completeMessage(QString("%1 %2 %3")
                .arg(levelName, 5)
                .arg(QDateTime::currentDateTime().toString(fmtDateTime))
                .arg(buffer)
                );

        Logger& logger = Logger::instance();
        QMutexLocker lock(&logger.d->logMutex);
        logger.write(completeMessage);
    }
    void Logger::Helper::write()
    {
        const QString level = LevelToText(myMessageLevel);
        const QString message(QString("%1 %2 %3")
            .arg(level,5)
            .arg(QDateTime::currentDateTime().toString("dd-MM-yyyy hh:mm:ss.zzz"))
            .arg(myStringBuffer)
            );

        Logger& logger = Logger::Instance();

        QMutexLocker lock(&logger.pImpl->myMutex); ///< &pImpl = memory location of pointee (myMutex)
        logger.write(message, myMessageLevel, logger.pImpl->myLoggerDestinationGroup);
    }
Exemple #4
0
//! creates the complete log message and passes it to the logger
void Logger::Helper::writeToLog()
{
    const char* const levelName = LevelToText(level);
    QString completeMessage;
    Logger &logger = Logger::instance();
    if (logger.includeLogLevel()) {
        completeMessage.
                append(levelName).
                append(' ');
    }
    if (logger.includeTimestamp()) {
        completeMessage.
                append(QDateTime::currentDateTime().toString(fmtDateTime)).
                append(' ');
    }
    completeMessage.append(buffer);
    Logger::instance().enqueueWrite(completeMessage, level);
}