fix(rn,logging) skip some logs on mobile

This commit is contained in:
Saúl Ibarra Corretgé 2021-09-01 17:26:30 +02:00 committed by Saúl Ibarra Corretgé
parent a687907105
commit 7b4a426ad2
1 changed files with 19 additions and 2 deletions

View File

@ -4,6 +4,9 @@ import { equals, ReducerRegistry, set } from '../redux';
import { SET_LOG_COLLECTOR, SET_LOGGING_CONFIG } from './actionTypes';
// eslint-disable-next-line
const LOGGING_CONFIG = require('../../../../logging_config.js');
/**
* The default/initial redux state of the feature base/logging.
*
@ -12,8 +15,7 @@ import { SET_LOG_COLLECTOR, SET_LOGGING_CONFIG } from './actionTypes';
* }}
*/
const DEFAULT_STATE = {
// eslint-disable-next-line
config: require('../../../../logging_config.js'),
config: LOGGING_CONFIG,
/**
* The log collector.
@ -21,6 +23,21 @@ const DEFAULT_STATE = {
logCollector: undefined
};
// Reduce verbosity on mobile, it kills performance.
if (navigator.product === 'ReactNative') {
const RN_LOGGING_CONFIG = {
'modules/sdp/SDPUtil.js': 'info',
'modules/xmpp/ChatRoom.js': 'warn',
'modules/xmpp/JingleSessionPC.js': 'info',
'modules/xmpp/strophe.jingle.js': 'info'
};
DEFAULT_STATE.config = {
...LOGGING_CONFIG,
...RN_LOGGING_CONFIG
};
}
ReducerRegistry.register(
'features/base/logging',
(state = DEFAULT_STATE, action) => {