标签:cat strong main debug iostream error format fat except
boost 日志
#include <boost/log/trivial.hpp> #include <boost/log/core.hpp> //配置可选级别 #include <boost/log/expressions.hpp> //配置可选级别 #include <boost/log/utility/setup/file.hpp> //写入文件 #include <iostream> void init() { boost::log::add_file_log("sample.log"); boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::info); } int main() { init(); try { BOOST_LOG_TRIVIAL(trace)<<"A trace msaage"; BOOST_LOG_TRIVIAL(debug)<<"A debug msaage"; BOOST_LOG_TRIVIAL(info)<<"A informational msaage"; BOOST_LOG_TRIVIAL(warning)<<"A warning msaage"; BOOST_LOG_TRIVIAL(error)<<"A error msaage"; BOOST_LOG_TRIVIAL(fatal)<<"A fatal msaage"; } catch(std::exception &e) { std::cout<<"Exception:"<<e.what()<<std::endl; } return 0; }
标签:cat strong main debug iostream error format fat except
原文地址:https://www.cnblogs.com/zhaohu/p/9402481.html