mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-01-01 16:23:02 +05:00
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import chalk from "chalk";
|
|
|
|
function format(tDate) {
|
|
return new Intl.DateTimeFormat("ru-RU", {
|
|
year: "numeric",
|
|
month: "2-digit",
|
|
day: "2-digit",
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
second: "2-digit",
|
|
}).format(tDate);
|
|
}
|
|
|
|
const logLevels = {
|
|
LOG: chalk.bgBlue("LOG"),
|
|
WARN: chalk.black.bgYellow("WARN"),
|
|
ERROR: chalk.black.bgRed("ERROR"),
|
|
DEBUG: chalk.green("DEBUG"),
|
|
CMD: chalk.black.bgWhite("CMD"),
|
|
READY: chalk.black.bgGreen("READY"),
|
|
};
|
|
|
|
export default {
|
|
log(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.LOG} ${content}`);
|
|
},
|
|
|
|
warn(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content}`);
|
|
},
|
|
|
|
error(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content}`);
|
|
},
|
|
|
|
debug(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content}`);
|
|
},
|
|
|
|
cmd(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content}`);
|
|
},
|
|
|
|
ready(content) {
|
|
return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content}`);
|
|
},
|
|
};
|