@@ -443,7 +443,7 @@ class SourceRootList implements SourceProvider {
443443 private _add ( dir : File ) : SourceRootInfo {
444444 const key : string = this . project . toRelativePath ( dir . path ) ;
445445 const watcher = platform . createSafetyFileWatcher ( dir , true ) ;
446- watcher . on ( 'error' , ( err ) => GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( err , 'Warning' ) ) ) ;
446+ watcher . on ( 'error' , ( err ) => GlobalEvent . log_warn ( err ) ) ;
447447 const sourceInfo = this . newSourceInfo ( key , watcher ) ;
448448 this . srcFolderMaps . set ( key , sourceInfo ) ;
449449 return sourceInfo ;
@@ -760,7 +760,7 @@ class SourceRootList implements SourceProvider {
760760
761761 } catch ( error ) {
762762 rootFolderInfo . needUpdate = true ; // set need update flag
763- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
763+ GlobalEvent . log_warn ( error ) ;
764764 }
765765 }
766766}
@@ -883,7 +883,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
883883 // suffix = model['groups']['linker']['$outputSuffix'];
884884 // }
885885 // } catch (error) {
886- // GlobalEvent.emit('globalLog', ExceptionToMessage( error, 'Error') );
886+ // GlobalEvent.log_error( error);
887887 // }
888888 // return this.getExecutablePathWithoutSuffix() + suffix;
889889 }
@@ -1701,7 +1701,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
17011701 const rePath = this . ToRelativePath ( outDir . path ) || outDir . path ;
17021702
17031703 if ( outDir . IsDir ( ) ) {
1704- GlobalEvent . emit ( 'globalLog' , newMessage ( 'Warning' , `'${ rePath } ' directory is already exists !, Aborted !` ) ) ;
1704+ GlobalEvent . log_warn ( `'${ rePath } ' directory is already exists !, Aborted !` ) ;
17051705 continue ;
17061706 }
17071707
@@ -1852,7 +1852,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
18521852 cfg = yaml . parse ( fcfg . Read ( ) ) ;
18531853 } catch ( error ) {
18541854 GlobalEvent . emit ( 'msg' , newMessage ( 'Warning' , `Parse '${ fcfg . name } ' failed !` ) ) ;
1855- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error' ) ) ;
1855+ GlobalEvent . log_error ( error ) ;
18561856 GlobalEvent . emit ( 'globalLog.show' ) ;
18571857 return undefined ;
18581858 }
@@ -1897,7 +1897,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
18971897 }
18981898 CC_OBJ_SUFFIX = mcc [ '$outputSuffix' ] || '.o' ;
18991899 } catch ( error ) {
1900- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error' ) ) ;
1900+ GlobalEvent . log_error ( error ) ;
19011901 return undefined ;
19021902 }
19031903
@@ -2168,7 +2168,7 @@ $(OUT_DIR):
21682168 if ( optsObj . options [ targetName ] == undefined ) optsObj . options [ targetName ] = { } ;
21692169 return optsObj . options [ targetName ] ;
21702170 } catch ( error ) {
2171- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error' ) ) ;
2171+ GlobalEvent . log_error ( error ) ;
21722172 }
21732173 }
21742174
@@ -2180,7 +2180,7 @@ $(OUT_DIR):
21802180 optsObj . options [ targetName || this . getCurrentTarget ( ) ] = cfg ;
21812181 optFile . Write ( view_str$prompt$filesOptionsComment + yaml . stringify ( optsObj , { indent : 4 } ) ) ;
21822182 } catch ( error ) {
2183- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error' ) ) ;
2183+ GlobalEvent . log_error ( error ) ;
21842184 }
21852185 }
21862186
@@ -2678,8 +2678,7 @@ $(OUT_DIR):
26782678 const fileOptions = yaml . parse ( file . Read ( ) ) ;
26792679 allFileOptions . push ( { targetName : allTargets [ idx ] , fileOptions : fileOptions } ) ;
26802680 } else {
2681- GlobalEvent . emit ( 'globalLog.append' ,
2682- `[Warn] This options file ".eide/${ file . name } " not match any target. remove it !\n` ) ;
2681+ GlobalEvent . log_warn ( `This options file ".eide/${ file . name } " not match any target. remove it !` ) ;
26832682 }
26842683 try { fs . unlinkSync ( file . path ) } catch { } // delete file
26852684 }
@@ -2858,7 +2857,7 @@ class EIDEProject extends AbstractProject {
28582857 try {
28592858 this . dependenceManager . InstallComponent ( packInfo . name , comp ) ;
28602859 } catch ( error ) {
2861- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
2860+ GlobalEvent . log_warn ( error ) ;
28622861 }
28632862 }
28642863 }
@@ -3061,8 +3060,7 @@ class EIDEProject extends AbstractProject {
30613060 let command = cmd_item . command . replace ( '-co' , '-sm -co' ) ;
30623061 child_process . exec ( command , { cwd : cmd_item . directory } , ( error : child_process . ExecException | null , stdout : string , stderr : string ) => {
30633062 if ( error ) {
3064- const msg = `Failed to make '${ deppath } ', msg: ${ ( < Error > error ) . message } ` ;
3065- GlobalEvent . emit ( 'globalLog' , newMessage ( 'Warning' , msg ) ) ;
3063+ GlobalEvent . log_warn ( `Failed to make '${ deppath } ', msg: ${ ( < Error > error ) . message } ` ) ;
30663064 try { fs . unlinkSync ( deppath ) } catch ( error ) { } // del old .d file
30673065 resolve ( ) ;
30683066 } else {
@@ -3075,7 +3073,7 @@ class EIDEProject extends AbstractProject {
30753073 }
30763074 }
30773075 } catch ( error ) {
3078- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
3076+ GlobalEvent . log_warn ( error ) ;
30793077 }
30803078
30813079 const toolName = toolchain_ || this . getToolchain ( ) . name ;
@@ -3097,7 +3095,7 @@ class EIDEProject extends AbstractProject {
30973095 this . srcRefMap . set ( srcpath , refs . map ( ( path ) => new File ( path ) ) ) ;
30983096 }
30993097 } catch ( error ) {
3100- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
3098+ GlobalEvent . log_warn ( error ) ;
31013099 }
31023100
31033101 // notify update src view
@@ -3344,7 +3342,7 @@ class EIDEProject extends AbstractProject {
33443342
33453343 proc . on ( 'line' , ( line ) => GlobalEvent . emit ( 'globalLog.append' , line + os . EOL ) ) ;
33463344 proc . on ( 'errLine' , ( line ) => GlobalEvent . emit ( 'globalLog.append' , line + os . EOL ) ) ;
3347- proc . on ( 'error' , ( err ) => GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( err ) ) ) ;
3345+ proc . on ( 'error' , ( err ) => GlobalEvent . log_error ( err ) ) ;
33483346
33493347 proc . on ( 'close' , ( exitInf ) => {
33503348 GlobalEvent . emit ( 'globalLog.append' , os . EOL + `process exited, exitCode: ${ exitInf . code } ` + os . EOL )
@@ -3356,7 +3354,7 @@ class EIDEProject extends AbstractProject {
33563354 } ) ;
33573355
33583356 } catch ( error ) {
3359- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error ) ) ;
3357+ GlobalEvent . log_error ( error )
33603358 GlobalEvent . emit ( 'globalLog.show' ) ;
33613359 }
33623360
@@ -3624,7 +3622,7 @@ class EIDEProject extends AbstractProject {
36243622 try {
36253623 platform . DeleteDir ( _d ) ;
36263624 } catch ( error ) {
3627- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error ) ) ;
3625+ GlobalEvent . log_error ( error ) ;
36283626 }
36293627 }
36303628 }
0 commit comments