pusher_t(const logger_type& log, record_t& record, Args&&... args) : log(log), record(record) { //!@todo: Catch exceptions from message inline formatting. record.insert( keyword::message() = aux::format(record.attributes(), std::forward<Args>(args)...) ); }
std::string format(const record_t& record) const { std::string buffer; stickystream_t stream; stream.attach(buffer); try { string::visitor_t visitor(stream, mapper, record.attributes()); for (auto it = tokens.begin(); it != tokens.end(); ++it) { boost::apply_visitor(visitor, *it); stream.flush(); } return buffer; } catch (const error_t& err) { throw error_t("bad format string '%s': %s", pattern, err.what()); } }
void handle(const record_t& record) { this->sink.consume(this->formatter.format(record), record.attributes()); }