Reduce path to file in logs. Show only part inside of root folder.
This commit is contained in:
parent
d331b5dc01
commit
3aec5bf341
|
@ -160,40 +160,41 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
|
|
||||||
{
|
{
|
||||||
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
||||||
|
QString const file = VAbstractApplication::ReduceLogContextFilePath(context.file);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, msg);
|
||||||
vStdOut() << QApplication::translate("mNoisyHandler", "DEBUG:") << msg << "\n";
|
vStdOut() << QApplication::translate("mNoisyHandler", "DEBUG:") << msg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, msg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "WARNING:") << msg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "WARNING:") << msg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, msg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "CRITICAL:") << msg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "CRITICAL:") << msg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, msg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << msg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << msg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, msg);
|
||||||
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << msg << "\n";
|
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << msg << "\n";
|
||||||
|
|
|
@ -196,40 +196,41 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
|
|
||||||
{
|
{
|
||||||
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
||||||
|
QString const file = VAbstractApplication::ReduceLogContextFilePath(context.file);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdOut() << QApplication::translate("mNoisyHandler", "DEBUG:") << logMsg << "\n";
|
vStdOut() << QApplication::translate("mNoisyHandler", "DEBUG:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "WARNING:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "WARNING:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "CRITICAL:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "CRITICAL:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << logMsg << "\n";
|
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << logMsg << "\n";
|
||||||
|
|
|
@ -225,12 +225,13 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
|
|
||||||
{
|
{
|
||||||
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
QString debugdate = "["_L1 + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
||||||
|
QString const file = VAbstractApplication::ReduceLogContextFilePath(context.file);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << logMsg << "\n";
|
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << logMsg << "\n";
|
||||||
|
@ -241,7 +242,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
||||||
}
|
}
|
||||||
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << logMsg << "\n";
|
||||||
|
@ -252,14 +253,14 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
||||||
}
|
}
|
||||||
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << logMsg << "\n";
|
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << logMsg << "\n";
|
||||||
|
@ -270,7 +271,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
|
||||||
}
|
}
|
||||||
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5")
|
||||||
.arg(context.file)
|
.arg(file)
|
||||||
.arg(context.line)
|
.arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << logMsg << "\n";
|
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << logMsg << "\n";
|
||||||
|
|
|
@ -287,6 +287,20 @@ auto VAbstractApplication::QtTranslationsPath(const QString &locale) -> QString
|
||||||
#endif // defined(Q_OS_LINUX)
|
#endif // defined(Q_OS_LINUX)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractApplication::ReduceLogContextFilePath(QString path) -> QString
|
||||||
|
{
|
||||||
|
// Find the position of the 'src' folder in the path
|
||||||
|
vsizetype const srcIndex = path.indexOf(QDir::toNativeSeparators(QStringLiteral("/src/")));
|
||||||
|
if (srcIndex != -1)
|
||||||
|
{
|
||||||
|
// Extract the substring starting from 'src' folder
|
||||||
|
path = path.mid(srcIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractApplication::getUndoStack() const -> QUndoStack *
|
auto VAbstractApplication::getUndoStack() const -> QUndoStack *
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,6 +78,8 @@ public:
|
||||||
static auto translationsPath(const QString &locale = QString()) -> QString;
|
static auto translationsPath(const QString &locale = QString()) -> QString;
|
||||||
static auto QtTranslationsPath(const QString &locale = QString()) -> QString;
|
static auto QtTranslationsPath(const QString &locale = QString()) -> QString;
|
||||||
|
|
||||||
|
static auto ReduceLogContextFilePath(QString path) -> QString;
|
||||||
|
|
||||||
void LoadTranslation(QString locale);
|
void LoadTranslation(QString locale);
|
||||||
|
|
||||||
virtual void OpenSettings() = 0;
|
virtual void OpenSettings() = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user