summaryrefslogtreecommitdiffstats
path: root/Tools/ProtoProxy/Connection.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-01-03 18:41:16 +0100
committerGitHub <noreply@github.com>2018-01-03 18:41:16 +0100
commit757231cc6e777b8f4717d1467ef7efa01c7fde15 (patch)
tree6d1021761ad1c492700fe17560cb79520e508d60 /Tools/ProtoProxy/Connection.cpp
parentConcrete mixing (#4096) (diff)
downloadcuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.gz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.bz2
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.lz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.xz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.zst
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.zip
Diffstat (limited to '')
-rw-r--r--Tools/ProtoProxy/Connection.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 940b9a7eb..9f602e873 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -10,6 +10,8 @@
#include "mbedTLS++/CryptoKey.h"
#include "../../src/Logger.h"
+#include "fmt/printf.h"
+
#ifdef _WIN32
#include <direct.h> // For _mkdir()
#endif
@@ -282,15 +284,12 @@ void cConnection::Run(void)
-void cConnection::Log(const char * a_Format, ...)
+void cConnection::Log(const char * a_Format, fmt::ArgList a_Args)
{
- va_list args;
- va_start(args, a_Format);
- AString msg;
- AppendVPrintf(msg, a_Format, args);
- va_end(args);
- AString FullMsg;
- Printf(FullMsg, "[%5.3f] %s\n", GetRelativeTime(), msg.c_str());
+ fmt::MemoryWriter FullMsg;
+ fmt::printf(FullMsg, "[%5.3f] ", GetRelativeTime());
+ fmt::printf(FullMsg, a_Format, a_Args);
+ fmt::printf(FullMsg, "\n");
// Log to file:
cCSLock Lock(m_CSLog);
@@ -307,16 +306,13 @@ void cConnection::Log(const char * a_Format, ...)
-void cConnection::DataLog(const void * a_Data, size_t a_Size, const char * a_Format, ...)
+void cConnection::DataLog(const void * a_Data, size_t a_Size, const char * a_Format, fmt::ArgList a_Args)
{
- va_list args;
- va_start(args, a_Format);
- AString msg;
- AppendVPrintf(msg, a_Format, args);
- va_end(args);
- AString FullMsg;
+ fmt::MemoryWriter FullMsg;
+ fmt::printf(FullMsg, "[%5.3f] ", GetRelativeTime());
+ fmt::printf(FullMsg, a_Format, a_Args);
AString Hex;
- Printf(FullMsg, "[%5.3f] %s\n%s\n", GetRelativeTime(), msg.c_str(), CreateHexDump(Hex, a_Data, a_Size, 16).c_str());
+ fmt::printf(FullMsg, "\n%s\n", CreateHexDump(Hex, a_Data, a_Size, 16));
// Log to file:
cCSLock Lock(m_CSLog);