1
0
Fork 0
mirror of https://github.com/syuilo/ai.git synced 2025-03-25 21:12:56 +00:00
ai/src/utils/log.ts
syuilo fd50dc790f ✌️
2024-01-21 13:27:02 +09:00

11 lines
348 B
TypeScript

import chalk from 'chalk';
export default function(msg: string) {
const now = new Date();
const date = `${zeroPad(now.getHours())}:${zeroPad(now.getMinutes())}:${zeroPad(now.getSeconds())}`;
console.log(`${chalk.gray(date)} ${msg}`);
}
function zeroPad(num: number, length: number = 2): string {
return ('0000000000' + num).slice(-length);
}