41 lines
No EOL
975 B
TypeScript
41 lines
No EOL
975 B
TypeScript
export const debug = (name: string, ...args: any[]) => {
|
|
if(!global.debug)return;
|
|
console.log(
|
|
"\x1b[33m%s\x1b[0m"+
|
|
"\x1b[1m\x1b[32m%s\x1b[0m",
|
|
(new Date()).toLocaleString(),
|
|
` [${name}]:`,
|
|
...args
|
|
);
|
|
};
|
|
|
|
export const log = (name: string, ...args: string[]) => {
|
|
console.log(
|
|
"\x1b[33m%s\x1b[0m"+
|
|
"\x1b[1m\x1b[36m%s\x1b[0m",
|
|
(new Date()).toLocaleString(),
|
|
` [${name}]:`,
|
|
...args
|
|
);
|
|
};
|
|
|
|
export const warn = (name: string, ...args: any[]) => {
|
|
console.warn(
|
|
"\x1b[33m%s\x1b[0m"+
|
|
"\x1b[1m\x1b[36m%s\x1b[0m",
|
|
(new Date()).toLocaleString(),
|
|
` [${name}]:`,
|
|
...args
|
|
);
|
|
};
|
|
|
|
export const error = (name: string, ...args: any[]) => {
|
|
console.error(
|
|
"\x1b[33m%s\x1b[0m"+
|
|
"\x1b[1m\x1b[41m%s\x1b[0m\x1b[41m",
|
|
(new Date()).toLocaleString()+" ",
|
|
`[${name}]:`,
|
|
...args,
|
|
"\x1b[0m"
|
|
);
|
|
}; |