From 51a1b87480973792fcadb35767d7b61f32d12df9 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Sun, 24 Apr 2011 16:59:50 +0200 Subject: auto-close removed, handled by fbgui nowmake --- src/loggerengine.cpp | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'src/loggerengine.cpp') diff --git a/src/loggerengine.cpp b/src/loggerengine.cpp index 51fba62..3a44159 100644 --- a/src/loggerengine.cpp +++ b/src/loggerengine.cpp @@ -32,8 +32,8 @@ bool LoggerEngine_fb::isInitialized() const { return true; } -void LoggerEngine_fb::writeFormatted(QxtLogger::LogLevel level, const QList< - QVariant> & msgs) { +void LoggerEngine_fb::writeFormatted(QxtLogger::LogLevel level, + const QList & msgs) { // ignore in case no messages was passed. if (msgs.isEmpty()) @@ -47,10 +47,10 @@ void LoggerEngine_fb::writeFormatted(QxtLogger::LogLevel level, const QList< // only write to console for debug level if (level == QxtLogger::DebugLevel) { Q_FOREACH(const QVariant& out, msgs) - { - if (!out.isNull()) - _debugConsole->insertPlainText(out.toString()); - } + { + if (!out.isNull()) + _debugConsole->insertPlainText(out.toString()); + } _debugConsole->insertPlainText(QString("\n")); // autoscroll QTextCursor c = _debugConsole->textCursor(); @@ -68,8 +68,8 @@ LoggerEngine_std::LoggerEngine_std() : LoggerEngine_std::~LoggerEngine_std() { } -void LoggerEngine_std::writeToStdErr(const QString& str_level, const QList< - QVariant> &msgs) { +void LoggerEngine_std::writeToStdErr(const QString& str_level, + const QList &msgs) { if (msgs.isEmpty()) return; @@ -78,10 +78,10 @@ void LoggerEngine_std::writeToStdErr(const QString& str_level, const QList< Q_ASSERT(errstream); *errstream << header; Q_FOREACH(const QVariant& out, msgs) - { - if (!out.isNull()) - *errstream << out.toString(); - } + { + if (!out.isNull()) + *errstream << out.toString(); + } *errstream << endl; } void LoggerEngine_std::writeToStdOut(const QString& level, @@ -89,3 +89,30 @@ void LoggerEngine_std::writeToStdOut(const QString& level, // reimplementing this is needed for compiling, // we only need write to std::err, so this function is not needed } +//--------------------------------------------------------------------------------------------------- +// slighty modified QxtBasicFileLoggerEngine +//--------------------------------------------------------------------------------------------------- +LoggerEngine_file::LoggerEngine_file() : + QxtBasicFileLoggerEngine() { +} + +LoggerEngine_file::~LoggerEngine_file() { +} + +LoggerEngine_file::initLoggerEngine() {} + +void LoggerEngine_file::writeToFile(const QString& str_level, + const QList &msgs) { + + if (msgs.isEmpty()) + return; + QIODevice* file = device(); + QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] "; + file->write(header.toUtf8()); + Q_FOREACH(const QVariant& out, msgs) + { + if (!out.isNull()) + file->write(out.toString().toUtf8()); + } + file->write("\n"); +} -- cgit v1.2.3-55-g7522