mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
adds close result logging
This commit is contained in:
@@ -960,6 +960,13 @@ private:
|
||||
*/
|
||||
void log_open_result();
|
||||
|
||||
/// 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();
|
||||
|
||||
// static settings
|
||||
const std::string m_user_agent;
|
||||
|
||||
|
||||
@@ -1296,7 +1296,10 @@ void connection<config>::terminate() {
|
||||
}
|
||||
} else {
|
||||
m_alog.write(log::alevel::devel,"terminate called on connection that was already terminated");
|
||||
return;
|
||||
}
|
||||
|
||||
log_close_result();
|
||||
} catch (const std::exception& e) {
|
||||
m_elog.write(log::elevel::warn,
|
||||
std::string("terminate failed. Reason was: ") + e.what());
|
||||
@@ -1765,6 +1768,20 @@ void connection<config>::log_open_result()
|
||||
m_alog.write(log::alevel::connect,s.str());
|
||||
}
|
||||
|
||||
template <typename config>
|
||||
void connection<config>::log_close_result()
|
||||
{
|
||||
std::stringstream s;
|
||||
|
||||
s << "Disconnect "
|
||||
<< "close local:[" << m_local_close_code
|
||||
<< (m_local_close_reason == "" ? "" : ","+m_local_close_reason)
|
||||
<< "] remote:[" << m_remote_close_code
|
||||
<< (m_remote_close_reason == "" ? "" : ","+m_remote_close_reason) << "]";
|
||||
|
||||
m_alog.write(log::alevel::disconnect,s.str());
|
||||
}
|
||||
|
||||
} // namespace websocketpp
|
||||
|
||||
#endif // WEBSOCKETPP_CONNECTION_IMPL_HPP
|
||||
|
||||
Reference in New Issue
Block a user