コード例 #1
0
ファイル: access_log.cpp プロジェクト: tj2013/served
void access_log(const served::response & res, const served::request & req)
{
	std::stringstream ss;

	boost::posix_time::time_facet *facet = new boost::posix_time::time_facet("%d/%b/%Y:%H:%M:%S");
	ss.imbue(std::locale(ss.getloc(), facet));

	std::string source = req.source();
	if ( source.empty() )
	{
		source = "-";
	}

	ss << source << " - - [" << boost::posix_time::second_clock::local_time() << " -0000]";
	ss << " \"" << method_to_string(req.method()) << " " << req.url().path() << " " << req.HTTP_version() << "\"";
	ss << " " << res.status() << " " << res.body_size();

	std::cout << ss.str() << std::endl;
}
コード例 #2
0
ファイル: multiplexer.test.cpp プロジェクト: datasift/served
	void operator()(served::response & response, const served::request & request)
	{
		(void) response;
		_story_obj.received.push_back(request.url().path());
		_story_obj.params = request.params;
	}