@@ -8,11 +8,12 @@ if(module.hot) {
88 var upToDate = function upToDate ( ) {
99 return lastHash . indexOf ( __webpack_hash__ ) >= 0 ;
1010 } ;
11+ var log = require ( "./log" ) ;
1112 var check = function check ( ) {
1213 module . hot . check ( ) . then ( function ( updatedModules ) {
1314 if ( ! updatedModules ) {
14- console . warn ( "[HMR] Cannot find update. Need to do a full reload!" ) ;
15- console . warn ( "[HMR] (Probably because of restarting the webpack-dev-server)" ) ;
15+ log ( "warning" , "[HMR] Cannot find update. Need to do a full reload!" ) ;
16+ log ( "warning" , "[HMR] (Probably because of restarting the webpack-dev-server)" ) ;
1617 return ;
1718 }
1819
@@ -21,14 +22,14 @@ if(module.hot) {
2122 ignoreDeclined : true ,
2223 ignoreErrored : true ,
2324 onUnaccepted : function ( data ) {
24- console . warn ( "Ignored an update to unaccepted module " + data . chain . join ( " -> " ) ) ;
25+ log ( "warning" , "Ignored an update to unaccepted module " + data . chain . join ( " -> " ) ) ;
2526 } ,
2627 onDeclined : function ( data ) {
27- console . warn ( "Ignored an update to declined module " + data . chain . join ( " -> " ) ) ;
28+ log ( "warning" , "Ignored an update to declined module " + data . chain . join ( " -> " ) ) ;
2829 } ,
2930 onErrored : function ( data ) {
30- console . error ( data . error ) ;
31- console . warn ( "Ignored an error while updating module " + data . moduleId + " (" + data . type + ")" ) ;
31+ log ( "error" , data . error ) ;
32+ log ( "warning" , "Ignored an error while updating module " + data . moduleId + " (" + data . type + ")" ) ;
3233 }
3334 } ) . then ( function ( renewedModules ) {
3435 if ( ! upToDate ( ) ) {
@@ -38,16 +39,16 @@ if(module.hot) {
3839 require ( "./log-apply-result" ) ( updatedModules , renewedModules ) ;
3940
4041 if ( upToDate ( ) ) {
41- console . log ( "[HMR] App is up to date." ) ;
42+ log ( "info" , "[HMR] App is up to date." ) ;
4243 }
4344 } ) ;
4445 } ) . catch ( function ( err ) {
4546 var status = module . hot . status ( ) ;
4647 if ( [ "abort" , "fail" ] . indexOf ( status ) >= 0 ) {
47- console . warn ( "[HMR] Cannot check for update. Need to do a full reload!" ) ;
48- console . warn ( "[HMR] " + err . stack || err . message ) ;
48+ log ( "warning" , "[HMR] Cannot check for update. Need to do a full reload!" ) ;
49+ log ( "warning" , "[HMR] " + err . stack || err . message ) ;
4950 } else {
50- console . warn ( "[HMR] Update check failed: " + err . stack || err . message ) ;
51+ log ( "warning" , "[HMR] Update check failed: " + err . stack || err . message ) ;
5152 }
5253 } ) ;
5354 } ;
@@ -57,14 +58,14 @@ if(module.hot) {
5758 if ( ! upToDate ( ) ) {
5859 var status = module . hot . status ( ) ;
5960 if ( status === "idle" ) {
60- console . log ( "[HMR] Checking for updates on the server..." ) ;
61+ log ( "info" , "[HMR] Checking for updates on the server..." ) ;
6162 check ( ) ;
6263 } else if ( [ "abort" , "fail" ] . indexOf ( status ) >= 0 ) {
63- console . warn ( "[HMR] Cannot apply update as a previous update " + status + "ed. Need to do a full reload!" ) ;
64+ log ( "warning" , "[HMR] Cannot apply update as a previous update " + status + "ed. Need to do a full reload!" ) ;
6465 }
6566 }
6667 } ) ;
67- console . log ( "[HMR] Waiting for update signal from WDS..." ) ;
68+ log ( "info" , "[HMR] Waiting for update signal from WDS..." ) ;
6869} else {
6970 throw new Error ( "[HMR] Hot Module Replacement is disabled." ) ;
7071}
0 commit comments