diff options
| author | Tannin <devnull@localhost> | 2014-04-05 15:36:42 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-04-05 15:36:42 +0200 |
| commit | cabed9b268c9f095d5e3b98a6797b0bcdcd38b1f (patch) | |
| tree | 454b03b0c5664e90fe586e7b39603e34a526d35b /src/logbuffer.cpp | |
| parent | 98e5e57a845541acddf519a81957261f58008cb9 (diff) | |
| parent | c017f4a0d50b67a44e276bd5ae8929ed3990c62c (diff) | |
Merge with branch1.1
Diffstat (limited to 'src/logbuffer.cpp')
| -rw-r--r-- | src/logbuffer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/logbuffer.cpp b/src/logbuffer.cpp index a3b6f1b5..689d2b55 100644 --- a/src/logbuffer.cpp +++ b/src/logbuffer.cpp @@ -21,6 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "report.h" #include <QMutexLocker> #include <QFile> +#include <QDateTime> #include <Windows.h> QScopedPointer<LogBuffer> LogBuffer::s_Instance; @@ -112,13 +113,25 @@ void LogBuffer::log(QtMsgType type, const QMessageLogContext &context, const QSt #else + +char LogBuffer::msgTypeID(QtMsgType type) +{ + switch (type) { + case QtDebugMsg: return 'D'; + case QtWarningMsg: return 'W'; + case QtCriticalMsg: return 'C'; + case QtFatalMsg: return 'F'; + default: return '?'; + } +} + void LogBuffer::log(QtMsgType type, const char *message) { QMutexLocker guard(&s_Mutex); if (!s_Instance.isNull()) { s_Instance->logMessage(type, message); } - fprintf(stdout, "%s\n", message); + fprintf(stdout, "%s [%c] %s\n", qPrintable(QTime::currentTime().toString()), msgTypeID(type), message); fflush(stdout); } |
