How to add color coding to boost::log console output?
问题 I'm trying to add colored log output for boost::log under linux. I read the following and I tried this: #define MY_LOG_ERROR() BOOST_LOG_TRIVIAL(error) << "\033[1;31" MY_LOG_ERROR() << "This is an error log." but it gives me the result below: [2016-07-11 17:23:16.328435] [0x00007f15f03d6780] [error] [1;31This is an error log. How to properly add colored log output to boost::log? 回答1: The proper way to customize output with Boost.Log is to use formatters. To set a formatter you will have to