@@ -8,8 +8,9 @@ import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api';
88import * as path from 'path' ;
99
1010import { IWorkspaceService } from '../common/application/types' ;
11+ import { traceError , traceInfo , traceWarning } from '../common/logger' ;
1112import { IFileSystem } from '../common/platform/types' ;
12- import { IConfigurationService , ILogger } from '../common/types' ;
13+ import { IConfigurationService } from '../common/types' ;
1314import { DefaultTheme } from './constants' ;
1415import { ICodeCssGenerator , IThemeFinder } from './types' ;
1516
@@ -98,7 +99,6 @@ export class CodeCssGenerator implements ICodeCssGenerator {
9899 @inject ( IWorkspaceService ) private workspaceService : IWorkspaceService ,
99100 @inject ( IThemeFinder ) private themeFinder : IThemeFinder ,
100101 @inject ( IConfigurationService ) private configService : IConfigurationService ,
101- @inject ( ILogger ) private logger : ILogger ,
102102 @inject ( IFileSystem ) private fs : IFileSystem
103103 ) { }
104104
@@ -123,13 +123,13 @@ export class CodeCssGenerator implements ICodeCssGenerator {
123123
124124 // Then we have to find where the theme resources are loaded from
125125 if ( theme ) {
126- this . logger . logInformation ( 'Searching for token colors ...' ) ;
126+ traceInfo ( 'Searching for token colors ...' ) ;
127127 const tokenColors = await this . findTokenColors ( theme ) ;
128128 const baseColors = await this . findBaseColors ( theme ) ;
129129
130130 // The tokens object then contains the necessary data to generate our css
131131 if ( tokenColors && fontFamily && fontSize ) {
132- this . logger . logInformation ( 'Using colors to generate CSS ...' ) ;
132+ traceInfo ( 'Using colors to generate CSS ...' ) ;
133133 result = applier ( { tokenColors, baseColors, fontFamily, fontSize, isDark : isDarkUpdated , defaultStyle : ignoreTheme ? LightTheme : undefined } ) ;
134134 } else if ( tokenColors === null && fontFamily && fontSize ) {
135135 // No colors found. See if we can figure out what type of theme we have
@@ -139,7 +139,7 @@ export class CodeCssGenerator implements ICodeCssGenerator {
139139 }
140140 } catch ( err ) {
141141 // On error don't fail, just log
142- this . logger . logError ( err ) ;
142+ traceError ( err ) ;
143143 }
144144
145145 return result ;
@@ -379,12 +379,12 @@ export class CodeCssGenerator implements ICodeCssGenerator {
379379
380380 private findTokenColors = async ( theme : string ) : Promise < JSONArray | null > => {
381381 try {
382- this . logger . logInformation ( 'Attempting search for colors ...' ) ;
382+ traceInfo ( 'Attempting search for colors ...' ) ;
383383 const themeRoot = await this . themeFinder . findThemeRootJson ( theme ) ;
384384
385385 // Use the first result if we have one
386386 if ( themeRoot ) {
387- this . logger . logInformation ( `Loading colors from ${ themeRoot } ...` ) ;
387+ traceInfo ( `Loading colors from ${ themeRoot } ...` ) ;
388388
389389 // This should be the path to the file. Load it as a json object
390390 const contents = await this . fs . readFile ( themeRoot ) ;
@@ -415,15 +415,15 @@ export class CodeCssGenerator implements ICodeCssGenerator {
415415 // Then the path entry should contain a relative path to the json file with
416416 // the tokens in it
417417 const themeFile = path . join ( path . dirname ( themeRoot ) , found . path ) ;
418- this . logger . logInformation ( `Reading colors from ${ themeFile } ` ) ;
418+ traceInfo ( `Reading colors from ${ themeFile } ` ) ;
419419 return await this . readTokenColors ( themeFile ) ;
420420 }
421421 } else {
422- this . logger . logWarning ( `Color theme ${ theme } not found. Using default colors.` ) ;
422+ traceWarning ( `Color theme ${ theme } not found. Using default colors.` ) ;
423423 }
424424 } catch ( err ) {
425425 // Swallow any exceptions with searching or parsing
426- this . logger . logError ( err ) ;
426+ traceError ( err ) ;
427427 }
428428
429429 // Force the colors to the defaults
@@ -432,12 +432,12 @@ export class CodeCssGenerator implements ICodeCssGenerator {
432432
433433 private findBaseColors = async ( theme : string ) : Promise < JSONObject | null > => {
434434 try {
435- this . logger . logInformation ( 'Attempting search for colors ...' ) ;
435+ traceInfo ( 'Attempting search for colors ...' ) ;
436436 const themeRoot = await this . themeFinder . findThemeRootJson ( theme ) ;
437437
438438 // Use the first result if we have one
439439 if ( themeRoot ) {
440- this . logger . logInformation ( `Loading base colors from ${ themeRoot } ...` ) ;
440+ traceInfo ( `Loading base colors from ${ themeRoot } ...` ) ;
441441
442442 // This should be the path to the file. Load it as a json object
443443 const contents = await this . fs . readFile ( themeRoot ) ;
@@ -465,15 +465,15 @@ export class CodeCssGenerator implements ICodeCssGenerator {
465465 // Then the path entry should contain a relative path to the json file with
466466 // the tokens in it
467467 const themeFile = path . join ( path . dirname ( themeRoot ) , found . path ) ;
468- this . logger . logInformation ( `Reading base colors from ${ themeFile } ` ) ;
468+ traceInfo ( `Reading base colors from ${ themeFile } ` ) ;
469469 return await this . readBaseColors ( themeFile ) ;
470470 }
471471 } else {
472- this . logger . logWarning ( `Color theme ${ theme } not found. Using default colors.` ) ;
472+ traceWarning ( `Color theme ${ theme } not found. Using default colors.` ) ;
473473 }
474474 } catch ( err ) {
475475 // Swallow any exceptions with searching or parsing
476- this . logger . logError ( err ) ;
476+ traceError ( err ) ;
477477 }
478478
479479 // Force the colors to the defaults
0 commit comments