summaryrefslogtreecommitdiff
path: root/src/logger.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-24 20:58:18 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-24 20:58:18 +0300
commit75c5b3d32afdb34b824daafaa6d4300b9a8ec06b (patch)
treecd40cd214fd3f590ec7af6f4ca5c627d4ffed068 /src/logger.cpp
parent280e7f9dcf757bed0bf652cee1a1485c695cc757 (diff)
downloadplus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.gz
plus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.bz2
plus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.xz
plus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.zip
Add option to disable logging for better performance while connected to server.
Diffstat (limited to 'src/logger.cpp')
-rw-r--r--src/logger.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/logger.cpp b/src/logger.cpp
index 2b80602e8..5a3efb0ee 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -22,6 +22,8 @@
#include "logger.h"
+#include "settings.h"
+
#include <iostream>
#include <sstream>
@@ -180,6 +182,9 @@ void Logger::dlog2(const std::string &str,
void Logger::log1(const char *const buf)
{
+ if (settings.disableLoggingInGame)
+ return;
+
// Get the current system time
timeval tv;
gettimeofday(&tv, nullptr);
@@ -198,6 +203,9 @@ void Logger::log1(const char *const buf)
void Logger::log(const char *const log_text, ...)
{
+ if (settings.disableLoggingInGame)
+ return;
+
unsigned size = 1024;
if (strlen(log_text) * 3 > size)
size = static_cast<unsigned>(strlen(log_text) * 3);
@@ -232,6 +240,9 @@ void Logger::log(const char *const log_text, ...)
void Logger::log_r(const char *const log_text, ...)
{
+ if (settings.disableLoggingInGame)
+ return;
+
SDL_mutexP(mMutex);
unsigned size = 1024;