@@ -131,35 +131,38 @@ export function getWorkflowEvent(env: Env = getEnv()): any {
131131 }
132132}
133133
134- export async function printDebugLogs ( config : Partial < Config > ) {
134+ export async function printDebugLogs ( logger : Logger , config : Partial < Config > ) {
135135 if (
136136 ! hasConfigKey ( config , "languages" ) ||
137137 ! hasConfigKey ( config , "dbLocation" )
138138 ) {
139+ logger . debug (
140+ `Not printing debug logs, because the configuration does not include the 'languages' or 'dbLocation' fields.` ,
141+ ) ;
139142 return ;
140143 }
141144
142145 for ( const language of config . languages ) {
143146 const databaseDirectory = getCodeQLDatabasePath ( config , language ) ;
144147 const logsDirectory = path . join ( databaseDirectory , "log" ) ;
145148 if ( ! doesDirectoryExist ( logsDirectory ) ) {
146- core . info ( `Directory ${ logsDirectory } does not exist.` ) ;
149+ logger . info ( `Directory ${ logsDirectory } does not exist.` ) ;
147150 continue ; // Skip this language database.
148151 }
149152
150153 const walkLogFiles = ( dir : string ) => {
151154 const entries = fs . readdirSync ( dir , { withFileTypes : true } ) ;
152155 if ( entries . length === 0 ) {
153- core . info ( `No debug logs found at directory ${ logsDirectory } .` ) ;
156+ logger . info ( `No debug logs found at directory ${ logsDirectory } .` ) ;
154157 }
155158 for ( const entry of entries ) {
156159 if ( entry . isFile ( ) ) {
157160 const absolutePath = path . resolve ( dir , entry . name ) ;
158- core . startGroup (
161+ logger . startGroup (
159162 `CodeQL Debug Logs - ${ language } - ${ entry . name } from file at path ${ absolutePath } ` ,
160163 ) ;
161- process . stdout . write ( fs . readFileSync ( absolutePath ) ) ;
162- core . endGroup ( ) ;
164+ logger . info ( fs . readFileSync ( absolutePath , "utf-8" ) ) ;
165+ logger . endGroup ( ) ;
163166 } else if ( entry . isDirectory ( ) ) {
164167 walkLogFiles ( path . resolve ( dir , entry . name ) ) ;
165168 }
0 commit comments