Пример #1
0
 void log(
     LogLevel level,
     std::ostream& stream,
     std::mutex& mutex,
     const char* file,
     unsigned line,
     const char* function,
     const crossbow::string& str,
     Args&&... args) {
     if (config.level > level) return;
     boost::format formatter(str.c_str());
     LogFormatter<Args...> fmt;
     fmt.format(formatter, std::forward<Args>(args)...);
     std::lock_guard<std::mutex> _(mutex);
     stream << formatter.str();
     stream << " (in " << function << " at " << file << ':' << line << ')' << std::endl;
 }
Пример #2
0
void FileLogAppender::write(LogFormatter &format, const LogEntry &entry) {
	std::ostringstream ostr;
	format.format(ostr, entry);
	ostr << "\r\n";
	auto str = ostr.str();
	truncate(str.length());
	logging_.write(str.c_str(), str.length());
	logging_.flush();
}
Пример #3
0
void DebugOutputLogSink::write(LogFormatter &format, LogEntry const &record) {
	std::ostringstream ostr;
	format.format(ostr, record);
	::OutputDebugStringA(ostr.str().c_str());
}
Пример #4
0
 void format(boost::format& f, Head h, Tail&&... tail) const {
     f % h;
     base.format(f, std::forward<Tail>(tail)...);
 }