summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-27 19:29:52 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-27 19:29:52 +0300
commit8333597dfaecfca2cac6b98390a8fb7131cb2a09 (patch)
treeff24e87dc5be6b2880b1cf25d5a03f2e926ce844 /src/net
parent3f0292bc97dec0c1c6a3c8997fb55012c4135480 (diff)
downloadmanaplus-8333597dfaecfca2cac6b98390a8fb7131cb2a09.tar.gz
manaplus-8333597dfaecfca2cac6b98390a8fb7131cb2a09.tar.bz2
manaplus-8333597dfaecfca2cac6b98390a8fb7131cb2a09.tar.xz
manaplus-8333597dfaecfca2cac6b98390a8fb7131cb2a09.zip
Add support for logging bytes from packets.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/messagein.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 4fb61dc6a..8a51667db 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -262,6 +262,21 @@ char *MessageIn::readBytes(int length)
buf[length + 1] = 0;
mPos += length;
+#ifdef ENABLEDEBUGLOG
+ std::string str;
+ for (int f = 0;f < length; f ++)
+ str += strprintf ("%02x", buf[f]);
+ str += " ";
+ for (int f = 0;f < length; f ++)
+ {
+ if (buf[f])
+ str += strprintf ("%c", buf[f]);
+ else
+ str += "_";
+ }
+ logger->log("ReadBytes: " + str);
+#endif
+
PacketCounters::incInBytes(length);
return buf;
}