mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Make logging cost free when there is no output target (#12247)
The logging streams now do almost no work when there is no output target for them. For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing.
This commit is contained in:
parent
ae7664597e
commit
0704ca0550
14 changed files with 336 additions and 192 deletions
|
@ -230,14 +230,14 @@ void Address::setPort(u16 port)
|
|||
m_port = port;
|
||||
}
|
||||
|
||||
void Address::print(std::ostream *s) const
|
||||
void Address::print(std::ostream& s) const
|
||||
{
|
||||
if (m_addr_family == AF_INET6)
|
||||
*s << "[" << serializeString() << "]:" << m_port;
|
||||
s << "[" << serializeString() << "]:" << m_port;
|
||||
else if (m_addr_family == AF_INET)
|
||||
*s << serializeString() << ":" << m_port;
|
||||
s << serializeString() << ":" << m_port;
|
||||
else
|
||||
*s << "(undefined)";
|
||||
s << "(undefined)";
|
||||
}
|
||||
|
||||
bool Address::isLocalhost() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue