summaryrefslogtreecommitdiff
path: root/TraceFile.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
commit5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch)
tree410fa358a5f73260a579b4d669730f319a4d2609 /TraceFile.cpp
parent6c82050de806dcdafaed0077400a6c3396a4a159 (diff)
parente0737c56c1e384e05064a0c6e1ac46979371041b (diff)
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack' with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'TraceFile.cpp')
-rw-r--r--TraceFile.cpp40
1 files changed, 2 insertions, 38 deletions
diff --git a/TraceFile.cpp b/TraceFile.cpp
index 032b8875..2329b425 100644
--- a/TraceFile.cpp
+++ b/TraceFile.cpp
@@ -6,18 +6,9 @@
#include <QString>
#include <QFile>
#include <QTextStream>
-#include <QMessageLogContext>
-#include <QDateTime>
-#include <QMutex>
-#include <QMutexLocker>
#include "pimpl_impl.hpp"
-namespace
-{
- QMutex lock;
-}
-
class TraceFile::impl
{
public:
@@ -81,35 +72,8 @@ TraceFile::impl::~impl ()
// write Qt messages to the diagnostic log file
void TraceFile::impl::message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
{
- char const * severity;
- switch (type)
- {
- case QtDebugMsg:
- severity = "Debug";
- break;
-
- case QtWarningMsg:
- severity = "Warning";
- break;
-
- case QtFatalMsg:
- severity = "Fatal";
- break;
-
- default:
- severity = "Critical";
- break;
- }
-
- {
- // guard against multiple threads with overlapping messages
- QMutexLocker guard (&lock);
- Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to");
- *current_stream_
- << QDateTime::currentDateTimeUtc ().toString ("yyyy-MM-ddTHH:mm:ss.zzzZ")
- << '(' << context.file << ':' << context.line /* << ", " << context.function */ << ')'
- << severity << ": " << msg.trimmed () << endl;
- }
+ Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to");
+ *current_stream_ << qFormatLogMessage (type, context, msg) << endl;
if (QtFatalMsg == type)
{