-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
93 lines (78 loc) · 2.25 KB
/
test.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const Rlog = require("./index.js");
const rlog = new Rlog({
logFilePath: "./log.txt",
timezone: "Asia/Shanghai",
});
rlog.config.setConfigGlobal({
blockedWordsList: ["world", "[0-9]{9}"],
});
// rlog.config.logFilePath = './log.txt'
// rlog.config.timezone = 'Asia/Shanghai'
// Register an exit callback to display additional information
rlog.onExit(() => {
rlog.warning('rlog.exit() called and event triggered.');
});
function test() {
let a = null;
}
rlog.info("This is a info");
rlog.success("This is a success");
rlog.warning("This is a warning");
rlog.error("This is a error");
rlog.info("Testing colorize type:");
rlog.info(123);
rlog.info(true);
rlog.info({
time: Date.now(),
text: "example",
});
rlog.info([1, 2, "5"]);
rlog.info(test);
rlog.info("Testing lock words:");
rlog.info(`hello world !! 123456789`);
rlog.info("");
rlog.info("Testing colorize string:");
rlog.info("Welcome to https://github.com/RavelloH/RLog");
rlog.info("This is a ip: 123.45.67.89");
rlog.info("This is a date: 1970-12-12");
rlog.info("Boolean false true");
rlog.info("");
rlog.info("Test multi line output");
rlog.info(`1\n22\n333\n4444`);
rlog.info("");
rlog.info("Test automatic recognition");
rlog.log("This is a success message.");
rlog.log("This is a warning message.");
rlog.log("This is an error message.");
rlog.log("This is an info message.");
rlog.info("");
rlog.info("Test Time Zone Conversion");
rlog.config.timezone = "Pacific/Port_Moresby";
rlog.info("Pacific/Port_Moresby");
rlog.config.timezone = "America/Chicago";
rlog.info("America/Chicago");
rlog.config.timezone = "Asia/Shanghai";
rlog.info("Asia/Shanghai");
rlog.info("");
rlog.info("Test Time Format");
rlog.config.timeFormat = "UTC",
rlog.info("UTC")
rlog.config.timeFormat = "timestamp",
rlog.info("timestamp")
rlog.config.timeFormat = "ISO",
rlog.info("ISO")
rlog.config.timeFormat = "YYYY-MM-DD HH:mm:ss.SSS",
rlog.info("YYYY-MM-DD HH:mm:ss.SSS")
rlog.info("");
rlog.log("Hello world!", "This is a message", 123, true);
rlog.info("Hello world!", "This is a message", 123, true);
rlog.progress(10,100)
rlog.progress(50,100)
rlog.progress(100,100)
rlog.info("Test security exit");
rlog.exit("Force to exit after saving logs");
/* console.time()
for (i=0;i<=1000;i++) {
rlog.info(i)
}
console.timeEnd() */