I have the following simple setup:
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/expressions/keyword.hpp>
namespace mynamespace
{
namespace keywords = boost::log::keywords;
namespace expr = boost::log::expressions;
enum SeverityLevel
{
Trace,
Debug,
Info,
Warning,
Error,
Critical
};
class LoggingConfig
{
public:
void init()
{
// Add default console logging sink
auto format = expr::stream << expr::message;
boost::log::add_console_log(std::cout, keywords::format=format);
};
};
}
Compiling gives this:
/Users/iulian/ClionProjects/project/util/logging.hpp:33:40: error: invalid operands to binary expression ('const stream_type' (aka 'const actor<base_type>') and 'const message_type' (aka 'const attribute_keyword<tag::message>'))
auto format = expr::stream << expr::message;
~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
I have seen numerous example of configuring the format etc in a similar manner to what I am trying above. Why doesn't this compile?
Aucun commentaire:
Enregistrer un commentaire