
On Saturday 20 October 2012 10:15:23 syvyi wrote:
sink_ptr->locked_backend( )->set_formatter ( fmt::format( "%1% : [%2%] [%3%] [%4%] [%5%] %6%" ) % fmt::attr< boost::uint32_t > ( "LineID" ) % fmt::attr< std::string > ( "Channel", std::nothrow ) % fmt::date_time< boost::posix_time::ptime > ( "Date_time", keywords::format = "%Y.%m.%d %H:%M:%S.%f" ) % fmt::attr< severity_level >( "Severity", std::nothrow ) % fmt::named_scope( "Scope", keywords::iteration = fmt::reverse, keywords::delimiter = " | " ) % fmt::message( ) );
That is how I do this. That what my question was about. How to use boost.log to have both char and wchar_t for an output to in file backend?
With the current trunk you can't use both, the library will act as if there are two different libraries for two different character types. This changed in bleeding-edge, but I don't recommend using it now. Initialization of the wide-character logging is similar to the narrow- character one. You just have to use wide-character string for attribute names and format strings and use w-prefixed typedefs for sinks, core and loggers (like wtext_file_backend instead of text_file_backend).