mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Issue #77 Break cyclic dependency between CStatusMessage and CLogPattern by moving methods from one to the other
This commit is contained in:
@@ -71,6 +71,23 @@ namespace BlackMisc
|
||||
return names;
|
||||
}
|
||||
|
||||
QStringList CLogPattern::humanReadableNamesFrom(const CStatusMessage &message)
|
||||
{
|
||||
QStringList patternNames;
|
||||
for (const QString &name : CLogPattern::allHumanReadableNames())
|
||||
{
|
||||
if (CLogPattern::fromHumanReadableName(name).match(message)) { patternNames.push_back(name); }
|
||||
}
|
||||
return patternNames;
|
||||
}
|
||||
|
||||
QStringList CLogPattern::humanOrTechnicalCategoriesFrom(const CStatusMessage &message)
|
||||
{
|
||||
if (message.getCategories().isEmpty()) { return {}; }
|
||||
QStringList c(humanReadableNamesFrom(message).join(", "));
|
||||
return c.isEmpty() ? message.getCategories().toQStringList() : c;
|
||||
}
|
||||
|
||||
const CLogPattern &CLogPattern::fromHumanReadableName(const QString &name)
|
||||
{
|
||||
static const CLogPattern empty {};
|
||||
|
||||
Reference in New Issue
Block a user