Console logs in Release mode React native IOS

Spread the love

v0.63 and up

Go to xcode, CMD + Shift + O, search for RCTLog.mm

Look for the block below:

static os_log_type_t RCTLogTypeForLogLevel(RCTLogLevel logLevel)
{
  if (logLevel < RCTLogLevelInfo) {
    return OS_LOG_TYPE_DEBUG;
  } else if (logLevel <= RCTLogLevelWarning) {
    return OS_LOG_TYPE_INFO;
  } else {
    return OS_LOG_TYPE_ERROR;
  }
}

and change it to

static os_log_type_t RCTLogTypeForLogLevel(RCTLogLevel logLevel)
{
  // if (logLevel < RCTLogLevelInfo) {
  //   return OS_LOG_TYPE_DEBUG;
  // } else if (logLevel <= RCTLogLevelWarning) {
  //   return OS_LOG_TYPE_INFO;
  // } else {
    return OS_LOG_TYPE_ERROR;
  // }
}