mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:25:54 +08:00
CFileLogger: group messages by category.
This commit is contained in:
committed by
Klaus Basan
parent
8e6422d2be
commit
6bfbaefdc8
@@ -69,13 +69,16 @@ namespace BlackMisc
|
|||||||
if (statusMessage.isEmpty()) { return; }
|
if (statusMessage.isEmpty()) { return; }
|
||||||
if (!m_logFile.isOpen()) { return; }
|
if (!m_logFile.isOpen()) { return; }
|
||||||
if (! m_logPattern.match(statusMessage)) { return; }
|
if (! m_logPattern.match(statusMessage)) { return; }
|
||||||
|
const QString categories = statusMessage.getCategoriesAsString();
|
||||||
|
if (categories != m_previousCategories)
|
||||||
|
{
|
||||||
|
writeContentToFile(QStringLiteral("\n[") % categories % QStringLiteral("]"));
|
||||||
|
m_previousCategories = categories;
|
||||||
|
}
|
||||||
const QString finalContent(QDateTime::currentDateTime().toString(QStringLiteral("hh:mm:ss "))
|
const QString finalContent(QDateTime::currentDateTime().toString(QStringLiteral("hh:mm:ss "))
|
||||||
% statusMessage.getSeverityAsString()
|
% statusMessage.getSeverityAsString()
|
||||||
% ": "
|
% ": "
|
||||||
% statusMessage.getMessage()
|
% statusMessage.getMessage());
|
||||||
% " cat: "
|
|
||||||
% statusMessage.getCategoriesAsString()
|
|
||||||
);
|
|
||||||
|
|
||||||
writeContentToFile(finalContent);
|
writeContentToFile(finalContent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ namespace BlackMisc
|
|||||||
QTextStream m_stream;
|
QTextStream m_stream;
|
||||||
QString m_applicationName;
|
QString m_applicationName;
|
||||||
QString m_logPath; //!< Empty by default. Hence the working directory "." is used
|
QString m_logPath; //!< Empty by default. Hence the working directory "." is used
|
||||||
|
QString m_previousCategories;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,10 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
while (isRepeatable());
|
while (isRepeatable());
|
||||||
|
|
||||||
if (!isValid) { CLogMessage(this).debug() << "Failed to match" << getDecoderType() << "in remaining METAR:" << metarString; }
|
if (!isValid)
|
||||||
|
{
|
||||||
|
CLogMessage(static_cast<CMetarDecoder*>(nullptr)).debug() << "Failed to match" << getDecoderType() << "in remaining METAR:" << metarString;
|
||||||
|
}
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ namespace BlackMisc
|
|||||||
//! Metar Decoder
|
//! Metar Decoder
|
||||||
class BLACKMISC_EXPORT CMetarDecoder : public QObject
|
class BLACKMISC_EXPORT CMetarDecoder : public QObject
|
||||||
{
|
{
|
||||||
public:
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
CMetarDecoder();
|
CMetarDecoder();
|
||||||
|
|
||||||
@@ -44,7 +45,6 @@ namespace BlackMisc
|
|||||||
private:
|
private:
|
||||||
void allocateDecoders();
|
void allocateDecoders();
|
||||||
std::vector<std::unique_ptr<IMetarDecoderPart>> m_decoders;
|
std::vector<std::unique_ptr<IMetarDecoderPart>> m_decoders;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user