-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlogger.ts
More file actions
44 lines (41 loc) · 1.81 KB
/
Copy pathlogger.ts
File metadata and controls
44 lines (41 loc) · 1.81 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import chalk from "chalk";
import { ChalkColors } from "../base/types/chalk.js";
const timestamp = () => chalk.dim(`${new Date().toISOString()}`);
// ? not sure about the success one but feel free to edit these! — lily
export const logger = {
info: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.blue("INFO")} ${message}`, ...args);
},
debug: (message: string, ...args: any[]) => {
if (process.env.DEBUG !== "true") return;
console.log(`${timestamp()} ${chalk.magenta("DEBUG")} ${message}`, ...args);
},
warn: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.yellow("WARN")} ${message}`, ...args);
},
error: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.red("ERROR")} ${message}`, ...args);
},
bot: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.cyan.bold("BOT")} ${message}`, ...args);
},
fatal: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.red.bold("FATAL")} ${message}`, ...args);
process.exit(1);
},
startup: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.green.bold("STARTUP")} ${message}`, ...args);
},
shutdown: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.yellow.bold("SHUTDOWN")} ${message}`, ...args);
},
deploy: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.green.bold("DEPLOY")} ${message}`, ...args);
},
success: (message: string, ...args: any[]) => {
console.log(`${timestamp()} ${chalk.green("✓")} ${message}`, ...args);
} ,
custom: (message: string, title: string, color: ChalkColors = "green", ...args: any[]) => {
console.log(`${timestamp()} ${chalk[color](title.toUpperCase())} ${message}`, ...args)
}
};