本文整理汇总了C++中LogComponent::getDottedName方法的典型用法代码示例。如果您正苦于以下问题:C++ LogComponent::getDottedName方法的具体用法?C++ LogComponent::getDottedName怎么用?C++ LogComponent::getDottedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogComponent
的用法示例。
在下文中一共展示了LogComponent::getDottedName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iter
StatusWith<std::vector<LogComponentSetting>> parseLogComponentSettings(const BSONObj& settings) {
typedef std::vector<LogComponentSetting> Result;
std::vector<LogComponentSetting> levelsToSet;
std::vector<BSONObjIterator> iterators;
LogComponent parentComponent = LogComponent::kDefault;
BSONObjIterator iter(settings);
while (iter.moreWithEOO()) {
BSONElement elem = iter.next();
if (elem.eoo()) {
if (!iterators.empty()) {
iter = iterators.back();
iterators.pop_back();
parentComponent = parentComponent.parent();
}
continue;
}
if (elem.fieldNameStringData() == "verbosity") {
if (!elem.isNumber()) {
return StatusWith<Result>(ErrorCodes::BadValue,
str::stream() << "Expected "
<< parentComponent.getDottedName()
<< ".verbosity to be a number, but found "
<< typeName(elem.type()));
}
levelsToSet.push_back((LogComponentSetting(parentComponent, elem.numberInt())));
continue;
}
const StringData shortName = elem.fieldNameStringData();
const LogComponent curr = _getComponentForShortName(shortName);
if (curr == LogComponent::kNumLogComponents || curr.parent() != parentComponent) {
return StatusWith<Result>(ErrorCodes::BadValue,
str::stream() << "Invalid component name "
<< parentComponent.getDottedName() << "."
<< shortName);
}
if (elem.isNumber()) {
levelsToSet.push_back(LogComponentSetting(curr, elem.numberInt()));
continue;
}
if (elem.type() != Object) {
return StatusWith<Result>(
ErrorCodes::BadValue,
str::stream() << "Invalid type " << typeName(elem.type()) << "for component "
<< parentComponent.getDottedName() << "." << shortName);
}
iterators.push_back(iter);
parentComponent = curr;
iter = BSONObjIterator(elem.Obj());
}
// Done walking settings
return StatusWith<Result>(levelsToSet);
}