mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +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 (!m_logFile.isOpen()) { 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 "))
|
||||
% statusMessage.getSeverityAsString()
|
||||
% ": "
|
||||
% statusMessage.getMessage()
|
||||
% " cat: "
|
||||
% statusMessage.getCategoriesAsString()
|
||||
);
|
||||
% statusMessage.getMessage());
|
||||
|
||||
writeContentToFile(finalContent);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace BlackMisc
|
||||
QTextStream m_stream;
|
||||
QString m_applicationName;
|
||||
QString m_logPath; //!< Empty by default. Hence the working directory "." is used
|
||||
QString m_previousCategories;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,10 @@ namespace BlackMisc
|
||||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,8 +30,9 @@ namespace BlackMisc
|
||||
//! Metar Decoder
|
||||
class BLACKMISC_EXPORT CMetarDecoder : public QObject
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Default constructor
|
||||
CMetarDecoder();
|
||||
|
||||
@@ -44,7 +45,6 @@ namespace BlackMisc
|
||||
private:
|
||||
void allocateDecoders();
|
||||
std::vector<std::unique_ptr<IMetarDecoderPart>> m_decoders;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user