Skip to content

Commit

Permalink
add environment check
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Feb 16, 2024
1 parent 3318c2d commit d73a814
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/Console/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import Onyx from 'react-native-onyx';
import {addLog} from '@libs/actions/Console';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Log} from '@src/types/onyx';
Expand Down Expand Up @@ -57,11 +58,12 @@ function logMessage(args: unknown[]) {

/**
* Override the console.log function to add logs to the store
* Log only in production environment to avoid storing large logs in development
* @param args arguments passed to the console.log function
*/
// eslint-disable-next-line no-console
console.log = (...args) => {
if (shouldStoreLogs) {
if (shouldStoreLogs && CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.DEV) {
logMessage(args);
}

Expand Down

0 comments on commit d73a814

Please sign in to comment.