-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogger.ts
30 lines (27 loc) · 807 Bytes
/
logger.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { greenBright, yellowBright, redBright } from "chalk";
class Logger {
constructor(private name: string) {}
info(...args: any[]) {
console.log(
`${greenBright(`(info)`)}${yellowBright(`[${this.name}]`)}`,
...args,
);
}
error(...args: any[]) {
console.log(
`${redBright(`(error)`)}${yellowBright(`[${this.name}]`)}`,
...args,
);
}
panic(...args: any[]) {
console.log(
`${redBright(`(panic)`)}${yellowBright(`[${this.name}]`)}`,
...args,
);
process.exit(1);
}
}
const logger = new Logger("music-bot");
export const info = logger.info.bind(logger);
export const error = logger.error.bind(logger);
export const panic = logger.panic.bind(logger);