我在我的程序中使用 boost.log,默认格式化程序以十六进制格式输出 ProcessID 和 ThreadID,任何人都知道如何以 dec 格式打印它们,谢谢。
这是我的代码的 github:https ://github.com/owenliang/boost_asio ,谢谢。
boost::log::formatter scope_formatter = boost::log::expressions::stream << "[" <<
boost::log::expressions::format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y-%m-%d %H:%M:%S") <<
"] [" << boost::log::expressions::attr<boost::log::attributes::current_process_id::value_type>("ProcessID") <<
"-" << boost::log::expressions::attr<boost::log::attributes::current_thread_id::value_type>("ThreadID") << "] [" <<
boost::log::expressions::attr<boost::log::trivial::severity_level>("Severity") <<
"] " << boost::log::expressions::format_named_scope("Scope", boost::log::keywords::format = "%c[%F:%l] ",
boost::log::keywords::depth = 1) << boost::log::expressions::smessage;