zoukankan      html  css  js  c++  java
  • boost log

     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;
    }
    

      

  • 相关阅读:
    Number Sequence
    不容易系列之(3)—— LELE的RPG难题
    又见回文
    统计元音
    数列
    regular expression
    野兽男孩
    GameStd
    boost and qt compile.
    kde4 + compiz只有两个桌面的问题
  • 原文地址:https://www.cnblogs.com/zhaohu/p/9402481.html
Copyright © 2011-2022 走看看