Created
January 25, 2018 11:12
-
-
Save ajiehatajie/590314691b5b6a945d5aa8b8a702e02e to your computer and use it in GitHub Desktop.
konfiguasi ReactToTron react native konsole log
This file contains 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
import Reactotron, { | |
trackGlobalErrors, | |
openInEditor, | |
overlay, | |
asyncStorage, | |
networking | |
} from 'reactotron-react-native' | |
Reactotron | |
.configure({ | |
name: 'Connect React Native Ktpelmu' | |
}) | |
.use(trackGlobalErrors()) | |
.use(openInEditor()) | |
.use(overlay()) | |
.use(asyncStorage()) | |
.use(networking()) | |
.connect() | |
// swizzle the old one | |
const yeOldeConsoleLog = console.log | |
// make a new one | |
console.log = (...args) => { | |
// always call the old one, because React Native does magic swizzling too | |
yeOldeConsoleLog(...args) | |
// send this off to Reactotron. | |
Reactotron.display({ | |
name: 'CONSOLE.LOG', | |
value: args, | |
preview: args.length > 0 && typeof args[0] === 'string' ? args[0] : null | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment