-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (45 loc) · 1.14 KB
/
index.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const chalk = require("chalk");
const dayjs = require("dayjs");
module.exports = class Logger {
constructor(content) {
this.content = content;
}
write(tag, error = false) {
const timestamp = `[${dayjs().format('DD/MM - HH:mm:ss')}]`;
const logTag = `[${tag}]`;
const stream = error ? process.stderr : process.stdout;
const format = "{tstamp} {tag} {text}\n";
const item = format
.replace("{tstamp}", chalk.gray(timestamp))
.replace("{tag}", chalk.gray(logTag))
.replace("{text}", chalk.white(this.content));
stream.write(item);
}
error() {
this.write('ERROR', true);
}
warn() {
this.write('WARN', false);
}
typo() {
this.write('TYPO', true);
}
command() {
this.write('COMMAND', false);
}
buttons() {
this.write('BUTTON', false);
}
event() {
this.write('EVENT', false);
}
interaction() {
this.write('INTERACTION', false);
}
client() {
this.write('CLIENT', false);
}
task() {
this.write('TASK', false);
}
}