0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::net: Simplify various log messages with loghead().

This commit is contained in:
Jason Volk 2018-12-12 09:05:15 -08:00
parent e97742ef39
commit a3f831e64f

View file

@ -138,7 +138,7 @@ ircd::net::loghead(const mutable_buffer &out,
return fmt::sprintf return fmt::sprintf
{ {
out, "socket:%lu local[%s] remote[%s]", out, "socket:%lu local[%s] remote[%s]",
id(*socket), id(socket),
string(buf[0], local_ipport(socket)), string(buf[0], local_ipport(socket)),
string(buf[1], remote_ipport(socket)), string(buf[1], remote_ipport(socket)),
}; };
@ -1394,10 +1394,8 @@ noexcept try
assert(bool(sock)); assert(bool(sock));
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] handshook(%zu) %s", log, "%s handshook(%zu) %s",
sock.get(), loghead(*sock),
string(local_ipport(*sock)),
string(remote_ipport(*sock)),
handshaking, handshaking,
string(ec) string(ec)
}; };
@ -1987,10 +1985,8 @@ ircd::net::socket::handshake(const open_opts &opts,
{ {
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] handshaking for '%s' to:%ld$ms", log, "%s handshaking for '%s' to:%ld$ms",
this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
common_name(opts), common_name(opts),
opts.handshake_timeout.count() opts.handshake_timeout.count()
}; };
@ -2023,10 +2019,8 @@ try
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] disconnect type:%d user: in:%zu out:%zu", log, "%s disconnect type:%d user: in:%zu out:%zu",
(const void *)this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
uint(opts.type), uint(opts.type),
in.bytes, in.bytes,
out.bytes out.bytes
@ -2285,10 +2279,8 @@ noexcept try
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] ready %s %s avail:%zu:%zu:%d", log, "%s ready %s %s avail:%zu:%zu:%d",
this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
reflect(type), reflect(type),
string(ec), string(ec),
type == ready::READ? bytes : 0UL, type == ready::READ? bytes : 0UL,
@ -2428,10 +2420,8 @@ noexcept try
const life_guard<socket> s{wp}; const life_guard<socket> s{wp};
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] connect %s", log, "%s connect %s",
this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
string(ec) string(ec)
}; };
@ -2501,10 +2491,8 @@ noexcept try
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] disconnect %s", log, "%s disconnect %s",
this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
string(ec) string(ec)
}; };
@ -2559,10 +2547,8 @@ noexcept try
log::debug log::debug
{ {
log, "socket(%p) local[%s] remote[%s] handshake %s", log, "%s handshake %s",
this, loghead(*this),
string(local_ipport(*this)),
string(remote_ipport(*this)),
string(ec) string(ec)
}; };