diff --git a/React/Base/RCTLog.m b/React/Base/RCTLog.m index 2e5c2c605..5486cb4c9 100644 --- a/React/Base/RCTLog.m +++ b/React/Base/RCTLog.m @@ -32,21 +32,24 @@ const char *RCTLogLevels[] = { "mustfix" }; +#if RCT_DEBUG +static const RCTLogLevel RCTDefaultLogThreshold = RCTLogLevelInfo - 1; +#else +static const RCTLogLevel RCTDefaultLogThreshold = RCTLogLevelError; +#endif + static RCTLogFunction RCTCurrentLogFunction; -static RCTLogLevel RCTCurrentLogThreshold; +static RCTLogLevel RCTCurrentLogThreshold = RCTDefaultLogThreshold; RCTLogLevel RCTGetLogThreshold() { - if (!RCTCurrentLogThreshold) { -#if RCT_DEBUG - RCTCurrentLogThreshold = RCTLogLevelInfo - 1; -#else - RCTCurrentLogThreshold = RCTLogLevelError; -#endif - } return RCTCurrentLogThreshold; } +void RCTSetLogThreshold(RCTLogLevel threshold) { + RCTCurrentLogThreshold = threshold; +} + RCTLogFunction RCTDefaultLogFunction = ^( RCTLogLevel level, NSString *fileName,