-1

In default mode boost.log writes to the console, which is fine by me. I'm trying to force it to auto-flush as well, however. All examples dealing with auto flush I can find show how to add a new sink, which seems unnecessary in my case. There is no method to get existing sinks via boost::log::core. Any ideas?

Andre
  • 637
  • 6
  • 16

1 Answers1

3

The default sink is intended to be used as a fallback of last resort and cannot be customized directly. Once you add a sink, the default sink will no longer be used. To log to the console with auto flushing enabled, one can use add_console_log.

boost::log::add_console_log(boost::log::keywords::auto_flush = true);
jspcal
  • 50,847
  • 7
  • 72
  • 76
  • 1
    Ended up doing this: "boost::log::add_console_log(std::cout, boost::log::keywords::auto_flush = true);" - works for me, thanks :) – Andre May 03 '18 at 04:11