本文整理汇总了C++中LogMessage::HasSubsystem方法的典型用法代码示例。如果您正苦于以下问题:C++ LogMessage::HasSubsystem方法的具体用法?C++ LogMessage::HasSubsystem怎么用?C++ LogMessage::HasSubsystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessage
的用法示例。
在下文中一共展示了LogMessage::HasSubsystem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoesMatch
bool LogFilterExactMatch::DoesMatch(const LogMessage &message) const {
switch (m_filter_target) {
case eFilterTargetActivity:
// Empty fields never match a condition.
if (!message.HasActivity())
return false;
return m_match_text == message.GetActivity();
case eFilterTargetActivityChain:
// Empty fields never match a condition.
if (!message.HasActivity())
return false;
return m_match_text == message.GetActivityChain();
case eFilterTargetCategory:
// Empty fields never match a condition.
if (!message.HasCategory())
return false;
return m_match_text == message.GetCategory();
case eFilterTargetMessage: {
const char *message_text = message.GetMessage();
return (message_text != nullptr) && (m_match_text == message_text);
}
case eFilterTargetSubsystem:
// Empty fields never match a condition.
if (!message.HasSubsystem())
return false;
return m_match_text == message.GetSubsystem();
default:
// We don't know this type.
return false;
}
}
示例2: DoesMatch
bool LogFilterRegex::DoesMatch(const LogMessage &message) const {
switch (m_filter_target) {
case eFilterTargetActivity:
// Empty fields never match a condition.
if (!message.HasActivity())
return false;
return ::regexec(&m_regex, message.GetActivity(), 0, nullptr, 0) == 0;
case eFilterTargetActivityChain:
// Empty fields never match a condition.
if (!message.HasActivity())
return false;
return ::regexec(&m_regex, message.GetActivityChain().c_str(), 0, nullptr,
0) == 0;
case eFilterTargetCategory:
// Empty fields never match a condition.
if (!message.HasCategory())
return false;
return ::regexec(&m_regex, message.GetCategory(), 0, nullptr, 0) == 0;
case eFilterTargetMessage: {
const char *message_text = message.GetMessage();
if (!message_text) {
DNBLogThreadedIf(LOG_DARWIN_LOG,
"LogFilterRegex: regex "
"\"%s\" no match due to nullptr message.",
m_regex_text.c_str());
return false;
}
bool match = ::regexec(&m_regex, message_text, 0, nullptr, 0) == 0;
DNBLogThreadedIf(LOG_DARWIN_LOG, "LogFilterRegex: regex "
"\"%s\" %s message \"%s\".",
m_regex_text.c_str(), match ? "matches" : "does not match",
message_text);
return match;
}
case eFilterTargetSubsystem:
// Empty fields never match a condition.
if (!message.HasSubsystem())
return false;
return ::regexec(&m_regex, message.GetSubsystem(), 0, nullptr, 0) == 0;
default:
// We don't know this type.
return false;
}
}