Skip to content

Commit

Permalink
tweak logging a smidge, improve info and final message
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Feb 12, 2020
1 parent e9b4ad0 commit bfc269f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/kbn-optimizer/src/log_optimizer_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) {
}

if (event?.type === 'worker started') {
log.info(`worker started for bundles ${event.bundles.map(b => b.id).join(', ')}`);
let moduleCount = 0;
for (const bundle of event.bundles) {
moduleCount += bundle.getModuleCount() ?? NaN;
}
const mcString = isFinite(moduleCount) ? String(moduleCount) : '?';
const bcString = String(event.bundles.length);
log.info(`starting worker [${bcString} bundles, ${mcString} modules]`);
}

if (state.phase === 'reallocating') {
Expand Down Expand Up @@ -113,7 +119,7 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) {
log.success(
config.watch
? `watching for changes in all bundles after ${state.durSec} sec`
: `all bundles compiled successfully after ${state.durSec} sec`
: `${state.compilerStates.length} bundles compiled successfully after ${state.durSec} sec`
);
return true;
}
Expand Down

0 comments on commit bfc269f

Please sign in to comment.