考勤记录详细的日志记录和放大器;升压程序选项 [英] glog verbose logging & Boost program options
本文介绍了考勤记录详细的日志记录和放大器;升压程序选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用升压
程序选项
在我的code和尝试添加使用详细日志记录出入记录
(谷歌日志库)。
I am using boost
program options
in my code and trying to add verbose logging using glog
(google logging library).
问题是,升压
捕捉命令行选项,我不能使用 - v
标志控制详细日志记录。是否有从code设置 minloglevel
的方法?我失败了定位功能或者这样做编程的宏...
The problem is that boost
captures the command line options and I can not use the --v
flag for controlling the verbose logging. Is there a method for setting the minloglevel
from the code? I failed locating a function or a macro for doing that programatically...
推荐答案
我有同样的问题,我在管理我的主要功能设置考勤记录标志如下:
I had the same problem and am managing to set glog flags in my main function as follows:
namespace po = boost::program_options;
int main(int ac, char **av) {
po::options_description desc("...");
desc.add_options()
("verbosity,v", po::value<int>(), "set verbose logging level, defaults to 0")
;
po::variables_map vm;
try{
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);
}
catch (po::required_option& e){
...
}
...
if (vm.count("verbosity")){
FLAGS_v = vm["verbosity"].as<int>();
}
else{
FLAGS_v = 0;
}
google::InitGoogleLogging("...");
}
这篇关于考勤记录详细的日志记录和放大器;升压程序选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文