split log_fail_result from log_close_result

This commit is contained in:
Peter Thorson
2013-06-08 18:31:21 -05:00
parent 33a0d89633
commit f35918ce6e
2 changed files with 15 additions and 3 deletions

View File

@@ -1040,11 +1040,16 @@ private:
/// Prints information about a connection being closed to the access log
/**
* Prints information about a connection being closed to the access log.
* Includes: local and remote close codes and reasons
*/
void log_close_result();
/// Prints information about a connection being failed to the access log
/**
* Includes: error code and message for why it was failed
*/
void log_fail_result();
// static settings
const std::string m_user_agent;

View File

@@ -1409,8 +1409,7 @@ void connection<config>::handle_terminate(terminate_status tstat,
if (m_fail_handler) {
m_fail_handler(m_connection_hdl);
}
// TODO: custom fail output log format?
log_close_result();
log_fail_result();
} else if (tstat == closed) {
if (m_close_handler) {
m_close_handler(m_connection_hdl);
@@ -1912,6 +1911,14 @@ void connection<config>::log_close_result()
m_alog.write(log::alevel::disconnect,s.str());
}
template <typename config>
void connection<config>::log_fail_result()
{
// TODO: include more information about the connection?
// should this be filed under connect rather than disconnect?
m_alog.write(log::alevel::disconnect,"Failed: "+m_ec.message());
}
} // namespace websocketpp
#endif // WEBSOCKETPP_CONNECTION_IMPL_HPP