44 type ExcludeNullableProps ,
55 asyncSequential ,
66 hasNoNullableProps ,
7- logger ,
87} from '@code-pushup/utils' ;
98import {
109 type CommandContext ,
@@ -16,6 +15,7 @@ import {
1615 runMergeDiffs ,
1716} from './cli/index.js' ;
1817import { commentOnPR } from './comment.js' ;
18+ import { log } from './log.js' ;
1919import type {
2020 GitBranch ,
2121 MonorepoRunResult ,
@@ -52,7 +52,7 @@ export async function runInMonorepoMode(
5252) : Promise < MonorepoRunResult > {
5353 const { api, settings } = env ;
5454
55- logger . info ( 'Running Code PushUp in monorepo mode' ) ;
55+ log ( 'info' , 'Running Code PushUp in monorepo mode' ) ;
5656
5757 const { projects, runManyCommand } = await listMonorepoProjects ( settings ) ;
5858 const projectResults = runManyCommand
@@ -71,7 +71,7 @@ export async function runInMonorepoMode(
7171 diffJsonPaths ,
7272 createCommandContext ( settings , projects [ 0 ] ) ,
7373 ) ;
74- logger . debug ( `Merged ${ diffJsonPaths . length } diffs into ${ tmpDiffPath } ` ) ;
74+ log ( 'debug' , `Merged ${ diffJsonPaths . length } diffs into ${ tmpDiffPath } ` ) ;
7575 const { md : diffPath } = await saveOutputFiles ( {
7676 project : null ,
7777 type : 'comparison' ,
@@ -105,7 +105,7 @@ function runProjectsIndividually(
105105 projects : ProjectConfig [ ] ,
106106 env : RunEnv ,
107107) : Promise < ProjectRunResult [ ] > {
108- logger . info ( `Running on ${ projects . length } projects individually` ) ;
108+ log ( 'info' , `Running on ${ projects . length } projects individually` ) ;
109109 return asyncSequential ( projects , project => runOnProject ( project , env ) ) ;
110110}
111111
@@ -119,7 +119,8 @@ async function runProjectsInBulk(
119119 settings,
120120 } = env ;
121121
122- logger . info (
122+ log (
123+ 'info' ,
123124 `Running on ${ projects . length } projects in bulk (parallel: ${ settings . parallel } )` ,
124125 ) ;
125126
@@ -173,7 +174,8 @@ async function loadProjectEnvs(
173174
174175 const hasFormats = allProjectsHaveDefaultPersistFormats ( projectEnvs ) ;
175176
176- logger . debug (
177+ log (
178+ 'debug' ,
177179 [
178180 configPatterns
179181 ? `Parsed ${ projectEnvs . length } persist and upload configs by interpolating configPatterns option for each project.`
@@ -211,7 +213,8 @@ async function compareProjectsInBulk(
211213 const uncachedProjectReports = projectReportsWithCache . filter (
212214 ( { prevReport } ) => ! prevReport ,
213215 ) ;
214- logger . info (
216+ log (
217+ 'info' ,
215218 `${ currProjectReports . length - uncachedProjectReports . length } out of ${ currProjectReports . length } projects loaded previous report from artifact cache` ,
216219 ) ;
217220
@@ -314,18 +317,21 @@ async function collectPreviousReports(
314317 . map ( ( { project } ) => project . name )
315318 . filter ( name => ! onlyProjects . includes ( name ) ) ;
316319 if ( invalidProjects . length > 0 ) {
317- logger . debug (
320+ log (
321+ 'debug' ,
318322 `Printing config failed for ${ invalidProjects . length } projects - ${ invalidProjects . join ( ', ' ) } ` ,
319323 ) ;
320- logger . info (
324+ log (
325+ 'info' ,
321326 `Skipping ${ invalidProjects . length } projects which aren't configured in base branch ${ base . ref } ` ,
322327 ) ;
323328 }
324329
325330 if ( onlyProjects . length > 0 ) {
326331 const hasFormats =
327332 allProjectsHaveDefaultPersistFormats ( validProjectConfigs ) ;
328- logger . info (
333+ log (
334+ 'info' ,
329335 `Collecting previous reports for ${ onlyProjects . length } projects` ,
330336 ) ;
331337 await collectMany ( runManyCommand , env , { hasFormats, onlyProjects } ) ;
@@ -377,7 +383,7 @@ async function collectMany(
377383 const countText = onlyProjects
378384 ? `${ onlyProjects . length } previous`
379385 : 'all current' ;
380- logger . debug ( `Collected ${ countText } reports using command \`${ command } \`` ) ;
386+ log ( 'debug' , `Collected ${ countText } reports using command \`${ command } \`` ) ;
381387}
382388
383389async function compareMany (
@@ -397,7 +403,7 @@ async function compareMany(
397403
398404 await runCompare ( ctx , { hasFormats } ) ;
399405
400- logger . debug ( 'Compared all project reports' ) ;
406+ log ( 'debug' , 'Compared all project reports' ) ;
401407}
402408
403409export function allProjectsHaveDefaultPersistFormats (
0 commit comments