Created
January 27, 2017 05:14
-
-
Save polodev/3a4571a01c3d92b7859bbbdd19665160 to your computer and use it in GitHub Desktop.
console log only in production in react native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in index.ios.js or index.android.js | |
global.LOG = (...args) => { | |
if (process.env.NODE_ENV === 'development') { | |
console.log('/------------------------------\\') | |
console.log('LOGGER', ...args) | |
console.log('\\------------------------------/') | |
} | |
return args[args.length - 1] | |
} | |
# if you use standard linting you have to add LOG inside your standard Globas array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment