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; +}