Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for custom log reporter cli option for local server
Summary: In Expo tools such as XDE, exp we listen listen to stdout from the packager process and print it in our own buffer. In the case of XDE, an electron app, our log pane is DOM-based, and before printing each log chunk we need to remove special tty characters and sometimes parse it to get information that we need (eg: progress bar). By using a custom reporter, we can take the raw events and pass them along in a format that is easy to consume by XDE and exp. This same motivation applies to create-react-native-app, where we currently don't show a progress bar in the terminal, but we can with this change. Create `LogReporter.js` in the root of a project with the CLI changes included in this PR. ``` class LogReporter { update(event) { console.log(JSON.stringify(event)); } } module.exports = LogReporter; ``` Now, run `react-native start --customLogReporterPath=LogReporter.js` -- all of the raw events will be output as JSON (while the logs Closes facebook#13172 Differential Revision: D4795760 Pulled By: hramos fbshipit-source-id: 80164b2f30e33a3f9965f4865a8404f8640a52c1
- Loading branch information