mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Simplify AppRegistry logging
Summary: This simplifies the first log message for every single reload. Here are the changes: * I dropped the "application" word because at Facebook we consider these views "surfaces". However, the method is explicitly called "runApplication" because in open source most people will only have a single "application". Removing the word and instead relying on the user specified string avoids the naming problem and doesn't take away from the information. * I removed the `__DEV__` and performance optimization log. The way RN is set up, developers will always have the correct settings for these in either dev or prod and printing them every time is superfluous. Also, it had a typo. How is it possible nobody ever noticed this? * I also simplified the invariant below to be half as long. I think it still has the same amount of information with fewer words (this is shown in a RedBox where there isn't that much space) Reviewed By: rubennorte Differential Revision: D16108248 fbshipit-source-id: 57351c68fa855c02bfbb1db6416d8db61eab4c19
This commit is contained in:
committed by
Facebook Github Bot
parent
11ff5670a9
commit
1f25d3c4ce
@@ -179,17 +179,7 @@ const AppRegistry = {
|
||||
*/
|
||||
runApplication(appKey: string, appParameters: any): void {
|
||||
const msg =
|
||||
'Running application "' +
|
||||
appKey +
|
||||
'" with appParams: ' +
|
||||
JSON.stringify(appParameters) +
|
||||
'. ' +
|
||||
'__DEV__ === ' +
|
||||
String(__DEV__) +
|
||||
', development-level warning are ' +
|
||||
(__DEV__ ? 'ON' : 'OFF') +
|
||||
', performance optimizations are ' +
|
||||
(__DEV__ ? 'OFF' : 'ON');
|
||||
'Running "' + appKey + '" with ' + JSON.stringify(appParameters);
|
||||
infoLog(msg);
|
||||
BugReporting.addSource(
|
||||
'AppRegistry.runApplication' + runCount++,
|
||||
@@ -197,18 +187,10 @@ const AppRegistry = {
|
||||
);
|
||||
invariant(
|
||||
runnables[appKey] && runnables[appKey].run,
|
||||
'Application ' +
|
||||
appKey +
|
||||
' has not been registered.\n\n' +
|
||||
"Hint: This error often happens when you're running the packager " +
|
||||
'(local dev server) from a wrong folder. For example you have ' +
|
||||
'multiple apps and the packager is still running for the app you ' +
|
||||
'were working on before.\nIf this is the case, simply kill the old ' +
|
||||
'packager instance (e.g. close the packager terminal window) ' +
|
||||
'and start the packager in the correct app folder (e.g. cd into app ' +
|
||||
"folder and run 'npm start').\n\n" +
|
||||
'This error can also happen due to a require() error during ' +
|
||||
'initialization or failure to call AppRegistry.registerComponent.\n\n',
|
||||
`"${appKey}" has not been registered. This can happen if:\n` +
|
||||
'* Metro (the local dev server) is run from the wrong folder. ' +
|
||||
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
||||
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
||||
);
|
||||
|
||||
SceneTracker.setActiveScene({name: appKey});
|
||||
|
||||
Reference in New Issue
Block a user