From 75c5b3d32afdb34b824daafaa6d4300b9a8ec06b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 24 Nov 2014 20:58:18 +0300 Subject: Add option to disable logging for better performance while connected to server. --- src/logger.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/logger.cpp') 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 #include @@ -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(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; -- cgit v1.2.3-70-g09d2