MCPcopy Create free account
hub / github.com/OneMoreGres/ScreenTranslator / handler

Function handler

src/service/debug.cpp:23–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21FILE *logFile{};
22
23void handler(QtMsgType type, const QMessageLogContext &context,
24 const QString &msg)
25{
26 const auto typeName = QMap<QtMsgType, QByteArray>{{QtDebugMsg, " DEBUG "},
27 {QtInfoMsg, " INFO "},
28 {QtWarningMsg, " WARN "},
29 {QtCriticalMsg, " CRIT "},
30 {QtFatalMsg, " FATAL "}}
31 .value(type);
32
33 const auto message =
34 QDateTime::currentDateTime().toString(Qt::ISODate).toUtf8() + ' ' +
35 QByteArray::number(qintptr(QThread::currentThreadId())) + ' ' +
36 QFileInfo(context.file).fileName().toUtf8() + ':' +
37 QByteArray::number(context.line) + typeName + msg.toUtf8() + '\n';
38
39 QMutexLocker locker(&mutex);
40 if (logFile)
41 write(fileno(logFile), message.data(), message.size());
42 if (realStderr > 0)
43 write(realStderr, message.data(), message.size());
44}
45
46void toDefaults()
47{

Callers

nothing calls this directly

Calls 4

valueMethod · 0.80
toStringMethod · 0.80
dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected