Skip to content

Commit 1d07d6b

Browse files
committed
fix(nf): logger code cleanup
1 parent 124bf55 commit 1d07d6b

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

  • libs/native-federation-core/src/lib/utils

libs/native-federation-core/src/lib/utils/logger.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@ export const logger = {
1313
verbose && console.log(chalk.bgGreen.ansi256(15)(' DBG! '), msg),
1414
debug: (msg: any) =>
1515
verbose && console.log(chalk.bgGreen.ansi256(15)(' DBG! '), msg),
16-
measure: (start: [number, number], msg: string) => {
16+
measure: (start: [number, number], milestone: string) => {
1717
if (!verbose) return;
1818

19-
var [seconds, nanoseconds] = process.hrtime(start);
20-
const minutes = Math.floor(seconds / 60);
21-
const remainingSeconds = seconds % 60;
19+
const [totalSeconds, nanoseconds] = process.hrtime(start);
20+
const minutes = Math.floor(totalSeconds / 60);
21+
const seconds = totalSeconds % 60;
2222
const milliseconds = nanoseconds / 1000000;
2323

2424
const msFormatted = milliseconds.toFixed(3);
2525
const timeStr =
2626
minutes > 0
27-
? `${minutes}:${remainingSeconds
27+
? `${minutes}:${seconds
2828
.toString()
2929
.padStart(2, '0')}:${msFormatted.padStart(7, '0')}`
30-
: remainingSeconds > 0
31-
? `${remainingSeconds}:${msFormatted.padStart(7, '0')}`
30+
: seconds > 0
31+
? `${seconds}:${msFormatted.padStart(7, '0')}`
3232
: `${msFormatted}ms`;
33-
console.log(chalk.bgGreen.ansi256(15)(' DBG! '), `${timeStr} - ${msg}`);
33+
console.log(
34+
chalk.bgGreen.ansi256(15)(' DBG! '),
35+
`${timeStr} - ${milestone}`
36+
);
3437
},
3538
};
3639

0 commit comments

Comments
 (0)