11 lines
535 B
TypeScript
11 lines
535 B
TypeScript
export function log(msg: string) {
|
|
const date = new Date()
|
|
const year = date.getFullYear()
|
|
const month = (date.getMonth()+1).toString().padStart(2, "0")
|
|
const day = date.getDate().toString().padStart(2, "0")
|
|
const hour = date.getHours().toString().padStart(2, "0")
|
|
const minutes = date.getMinutes().toString().padStart(2, "0")
|
|
const second = date.getSeconds().toString().padStart(2, "0")
|
|
const fullTime = `${year}-${month}-${day} ${hour}:${minutes}:${second}`
|
|
console.log(`[${fullTime}]: ${msg}`);
|
|
} |