10 lines
454 B
JavaScript
10 lines
454 B
JavaScript
function log(message, color = 'blue', type = 'INFO') {
|
|
const now = new Date();
|
|
const dateStr = `[${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}]`;
|
|
const timeStr = `[${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}]`;
|
|
const prefix = `${dateStr}${timeStr}[${type}] `;
|
|
const fullMessage = `${prefix}${message}`;
|
|
const style = `color: ${color}; font-weight: bold;`;
|
|
console.log(`%c${fullMessage}`, style);
|
|
}
|