本文整理汇总了C++中ACE_Log_Msg::priority_mask方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Log_Msg::priority_mask方法的具体用法?C++ ACE_Log_Msg::priority_mask怎么用?C++ ACE_Log_Msg::priority_mask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Log_Msg
的用法示例。
在下文中一共展示了ACE_Log_Msg::priority_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: arg_shifter
/**
* Adds the log cathegory clear names corresponding to the cathegory
* integer constants to the ACE_Log_Record.
*
* Parses the argument vector for the Miro command line option:
* -MiroLogLevel, -MiroLogFilter and -MiroLogDevice.
*
* @TODO -MiroLogDevice has no effect. - Needs to be implemented.
*/
void
Log::init(int& argc, char * argv[])
{
#if (GCC_MAJOR_VERSION >= 3)
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
#endif
mask_ = 0;
// register all logging cathegories at the log record
for (unsigned int i = 0; i < NUM_CATHEGORIES; ++i) {
ACE_Log_Record::priority_name((ACE_Log_Priority)cathegories[i].priority,
cathegories[i].name);
}
// parse command line arguments
ACE_Arg_Shifter arg_shifter (argc, argv);
while (arg_shifter.is_anything_left ()) {
const ACE_TCHAR *currentArg = arg_shifter.get_current ();
if (ACE_OS::strcasecmp(MIRO_LOG_LEVEL, currentArg) == 0 ||
ACE_OS::strcasecmp(MIRO_LOG_LEVEL_SHORT, currentArg) == 0 ) {
arg_shifter.consume_arg();
if (arg_shifter.is_parameter_next()) {
level_ = strtol(arg_shifter.get_current (), (char**)NULL, 10);
if (level_ == 0 && errno == ERANGE)
throw Miro::CException(errno, "Error parsing -MiroLogLevel");
arg_shifter.consume_arg();
}
}
else if (ACE_OS::strcasecmp(MIRO_LOG_FILTER, currentArg) == 0 ||
ACE_OS::strcasecmp(MIRO_LOG_FILTER_SHORT, currentArg) == 0 ) {
arg_shifter.consume_arg();
while (arg_shifter.is_parameter_next()) {
unsigned int i;
for (i = 0; i < NUM_CATHEGORIES; ++i) {
if (ACE_OS::strcasecmp(cathegories[i].name, arg_shifter.get_current ()) == 0) {
unsigned long p;
ACE_Log_Msg *l = ACE_Log_Msg::instance ();
p = l->priority_mask(ACE_Log_Msg::PROCESS);
p |= cathegories[i].priority;
l->priority_mask(p, ACE_Log_Msg::PROCESS);
break;
}
}
if (i == NUM_CATHEGORIES)
throw Miro::Exception(std::string("Unknown parameter for -MiroLogFilter: ") +
arg_shifter.get_current ());
arg_shifter.consume_arg();
}
}
else if (ACE_OS::strcasecmp(MIRO_LOG_DEVICE, currentArg) == 0) {
arg_shifter.consume_arg();
if (arg_shifter.is_parameter_next()) {
logDevice = arg_shifter.get_current ();
}
}
else {
arg_shifter.ignore_arg ();
}
}
mask_ = ACE_Log_Msg::instance()->priority_mask(ACE_Log_Msg::PROCESS);
// for (unsigned int i = 0; i < 32; ++i) {
// unsigned long p = 1UL << i;
// if (mask_ & p) {
// std::cout << "logged cathegory: "
// << ACE_Log_Record::priority_name((ACE_Log_Priority) p)
// << std::endl;
// }
// }
}