From 333b5c0ffc16772ff7387ded34aebce78088c6bb Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 21 Mar 2017 19:59:03 +0300 Subject: [PATCH] no message --- MTProtoKit/MTLogging.h | 1 + MTProtoKit/MTLogging.m | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MTProtoKit/MTLogging.h b/MTProtoKit/MTLogging.h index 32907bb35c..2f6e48b6a6 100644 --- a/MTProtoKit/MTLogging.h +++ b/MTProtoKit/MTLogging.h @@ -18,6 +18,7 @@ extern "C" { bool MTLogEnabled(); void MTLog(NSString *format, ...); void MTLogSetLoggingFunction(void (*function)(NSString *, va_list args)); +void MTLogSetEnabled(bool); #ifdef __cplusplus } diff --git a/MTProtoKit/MTLogging.m b/MTProtoKit/MTLogging.m index b1d330fc97..1668ebca69 100644 --- a/MTProtoKit/MTLogging.m +++ b/MTProtoKit/MTLogging.m @@ -9,9 +9,10 @@ #import "MTLogging.h" static void (*loggingFunction)(NSString *, va_list args) = NULL; +static bool MTLogEnabledValue = true; bool MTLogEnabled() { - return loggingFunction != NULL; + return loggingFunction != NULL && MTLogEnabledValue; } void MTLog(NSString *format, ...) { @@ -26,3 +27,7 @@ void MTLog(NSString *format, ...) { void MTLogSetLoggingFunction(void (*function)(NSString *, va_list args)) { loggingFunction = function; } + +void MTLogSetEnabled(bool enabled) { + MTLogEnabledValue = enabled; +}