@@ -86,7 +86,7 @@ namespace ts.server {
8686 // if the ref count for this directory watcher drops to 0, it's time to close it
8787 this . directoryWatchersRefCount [ directory ] -- ;
8888 if ( this . directoryWatchersRefCount [ directory ] === 0 ) {
89- this . projectService . log ( `Close directory watcher for: ${ directory } ` ) ;
89+ this . projectService . logger . info ( `Close directory watcher for: ${ directory } ` ) ;
9090 this . directoryWatchersForTsconfig [ directory ] . close ( ) ;
9191 delete this . directoryWatchersForTsconfig [ directory ] ;
9292 }
@@ -97,7 +97,7 @@ namespace ts.server {
9797 let parentPath = getDirectoryPath ( currentPath ) ;
9898 while ( currentPath != parentPath ) {
9999 if ( ! this . directoryWatchersForTsconfig [ currentPath ] ) {
100- this . projectService . log ( `Add watcher for: ${ currentPath } ` ) ;
100+ this . projectService . logger . info ( `Add watcher for: ${ currentPath } ` ) ;
101101 this . directoryWatchersForTsconfig [ currentPath ] = this . projectService . host . watchDirectory ( currentPath , callback ) ;
102102 this . directoryWatchersRefCount [ currentPath ] = 1 ;
103103 }
@@ -279,7 +279,7 @@ namespace ts.server {
279279 return ;
280280 }
281281
282- this . log ( `Detected source file changes: ${ fileName } ` ) ;
282+ this . logger . info ( `Detected source file changes: ${ fileName } ` ) ;
283283 this . throttledOperations . schedule (
284284 project . configFileName ,
285285 /*delay*/ 250 ,
@@ -306,7 +306,7 @@ namespace ts.server {
306306 }
307307
308308 private onConfigChangedForConfiguredProject ( project : ConfiguredProject ) {
309- this . log ( `Config file changed: ${ project . configFileName } ` ) ;
309+ this . logger . info ( `Config file changed: ${ project . configFileName } ` ) ;
310310 this . updateConfiguredProject ( project ) ;
311311 this . refreshInferredProjects ( ) ;
312312 }
@@ -317,11 +317,11 @@ namespace ts.server {
317317 private onConfigFileAddedForInferredProject ( fileName : string ) {
318318 // TODO: check directory separators
319319 if ( getBaseFileName ( fileName ) != "tsconfig.json" ) {
320- this . log ( `${ fileName } is not tsconfig.json` ) ;
320+ this . logger . info ( `${ fileName } is not tsconfig.json` ) ;
321321 return ;
322322 }
323323
324- this . log ( `Detected newly added tsconfig file: ${ fileName } ` ) ;
324+ this . logger . info ( `Detected newly added tsconfig file: ${ fileName } ` ) ;
325325 this . reloadProjects ( ) ;
326326 }
327327
@@ -331,7 +331,7 @@ namespace ts.server {
331331 }
332332
333333 private removeProject ( project : Project ) {
334- this . log ( `remove project: ${ project . getRootFiles ( ) . toString ( ) } ` ) ;
334+ this . logger . info ( `remove project: ${ project . getRootFiles ( ) . toString ( ) } ` ) ;
335335
336336 project . close ( ) ;
337337
@@ -460,16 +460,16 @@ namespace ts.server {
460460 */
461461 private openOrUpdateConfiguredProjectForFile ( fileName : NormalizedPath ) : OpenConfiguredProjectResult {
462462 const searchPath = getDirectoryPath ( fileName ) ;
463- this . log ( `Search path: ${ searchPath } ` , "Info" ) ;
463+ this . logger . info ( `Search path: ${ searchPath } ` ) ;
464464
465465 // check if this file is already included in one of external projects
466466 const configFileName = this . findConfigFile ( asNormalizedPath ( searchPath ) ) ;
467467 if ( ! configFileName ) {
468- this . log ( "No config files found." ) ;
468+ this . logger . info ( "No config files found." ) ;
469469 return { } ;
470470 }
471471
472- this . log ( `Config file name: ${ configFileName } ` , "Info" ) ;
472+ this . logger . info ( `Config file name: ${ configFileName } ` ) ;
473473
474474 const project = this . findConfiguredProjectByProjectName ( configFileName ) ;
475475 if ( ! project ) {
@@ -480,7 +480,7 @@ namespace ts.server {
480480
481481 // even if opening config file was successful, it could still
482482 // contain errors that were tolerated.
483- this . log ( `Opened configuration file ${ configFileName } ` , "Info" ) ;
483+ this . logger . info ( `Opened configuration file ${ configFileName } ` ) ;
484484 if ( errors && errors . length > 0 ) {
485485 return { configFileName, configFileErrors : errors } ;
486486 }
@@ -737,7 +737,7 @@ namespace ts.server {
737737
738738 private updateConfiguredProject ( project : ConfiguredProject ) {
739739 if ( ! this . host . fileExists ( project . configFileName ) ) {
740- this . log ( "Config file deleted" ) ;
740+ this . logger . info ( "Config file deleted" ) ;
741741 this . removeProject ( project ) ;
742742 return ;
743743 }
@@ -835,26 +835,22 @@ namespace ts.server {
835835 return this . filenameToScriptInfo . get ( fileName ) ;
836836 }
837837
838- log ( msg : string , type = "Err" ) {
839- this . logger . msg ( msg , type ) ;
840- }
841-
842838 setHostConfiguration ( args : protocol . ConfigureRequestArguments ) {
843839 if ( args . file ) {
844840 const info = this . getScriptInfoForNormalizedPath ( toNormalizedPath ( args . file ) ) ;
845841 if ( info ) {
846842 info . setFormatOptions ( args . formatOptions ) ;
847- this . log ( `Host configuration update for file ${ args . file } ` , "Info" ) ;
843+ this . logger . info ( `Host configuration update for file ${ args . file } ` ) ;
848844 }
849845 }
850846 else {
851847 if ( args . hostInfo !== undefined ) {
852848 this . hostConfiguration . hostInfo = args . hostInfo ;
853- this . log ( `Host information ${ args . hostInfo } ` , "Info" ) ;
849+ this . logger . info ( `Host information ${ args . hostInfo } ` ) ;
854850 }
855851 if ( args . formatOptions ) {
856852 mergeMaps ( this . hostConfiguration . formatCodeOptions , args . formatOptions ) ;
857- this . log ( "Format host information updated" , "Info ") ;
853+ this . logger . info ( "Format host information updated" ) ;
858854 }
859855 }
860856 }
@@ -867,7 +863,7 @@ namespace ts.server {
867863 * This function rebuilds the project for every file opened by the client
868864 */
869865 reloadProjects ( ) {
870- this . log ( "reload projects." ) ;
866+ this . logger . info ( "reload projects." ) ;
871867 // try to reload config file for all open files
872868 for ( const info of this . openFiles ) {
873869 this . openOrUpdateConfiguredProjectForFile ( info . fileName ) ;
@@ -881,7 +877,7 @@ namespace ts.server {
881877 * up to date.
882878 */
883879 refreshInferredProjects ( ) {
884- this . log ( "updating project structure from ..." , "Info ") ;
880+ this . logger . info ( "updating project structure from ..." ) ;
885881 this . printProjects ( ) ;
886882
887883 const orphantedFiles : ScriptInfo [ ] = [ ] ;
0 commit comments