summaryrefslogtreecommitdiff
path: root/TraceFile.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /TraceFile.cpp
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
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)
{