diff options
author | paradust7 <102263465+paradust7@users.noreply.github.com> | 2022-05-04 11:55:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 20:55:01 +0200 |
commit | 0704ca055059088bdd53e15be672e6b5663b8f50 (patch) | |
tree | 26d12dc712e19fcc38e3a70ef598efc665ab0d7f /src/network/address.cpp | |
parent | ae7664597ed15f9ac779a9bac0595ab4125457c4 (diff) | |
download | minetest-0704ca055059088bdd53e15be672e6b5663b8f50.tar.gz minetest-0704ca055059088bdd53e15be672e6b5663b8f50.tar.bz2 minetest-0704ca055059088bdd53e15be672e6b5663b8f50.zip |
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.
Diffstat (limited to 'src/network/address.cpp')
-rw-r--r-- | src/network/address.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/address.cpp b/src/network/address.cpp index 90e561802..cf2e6208d 100644 --- a/src/network/address.cpp +++ b/src/network/address.cpp @@ -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 |