-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (45 loc) · 932 Bytes
/
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
const colors = require("colors")
function log(string, type) {
switch(type) {
case "warn":
console.log("?? ".yellow + string)
break;
case "error":
console.log("!! ".red + string)
break;
case "status":
console.log(":: ".blue + string)
break;
case "success":
console.log("<> ".green + string)
break;
case "auto":
type = "default";
switch(string.slice(0, 2)) {
case "??":
type = "warn";
break;
case "!!":
type = "error";
break;
case "::":
type = "status";
break;
case "<>":
type = "success";
break;
}
log(string.slice(2, string.length).replace(/^ /g, ""), type)
break;
default:
console.log(string)
}
}
module.exports = {
log,
out: (str) => {log(str, "auto")},
warn: (str) => {log(str, "warn")},
error: (str) => {log(str, "error")},
status: (str) => {log(str, "status")},
success: (str) => {log(str, "success")}
}