Skip to content

Instantly share code, notes, and snippets.

@polodev
Created January 27, 2017 05:14
Show Gist options
  • Save polodev/3a4571a01c3d92b7859bbbdd19665160 to your computer and use it in GitHub Desktop.
Save polodev/3a4571a01c3d92b7859bbbdd19665160 to your computer and use it in GitHub Desktop.
console log only in production in react native
#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