corexxx 1.0.82 → 1.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dlog.d.ts +1 -0
- package/dist/dlog.js +24 -0
- package/dist/dlog.js.map +1 -1
- package/package.json +1 -1
- package/src/dlog.ts +23 -0
package/dist/dlog.d.ts
CHANGED
package/dist/dlog.js
CHANGED
|
@@ -10,6 +10,12 @@ const underscore_1 = __importDefault(require("underscore"));
|
|
|
10
10
|
//let _log = colorogs(true, true, __filename);
|
|
11
11
|
var dlog;
|
|
12
12
|
(function (dlog) {
|
|
13
|
+
let ignoreLog = false;
|
|
14
|
+
// call this function to ignore log in prod
|
|
15
|
+
function isDev(isDev) {
|
|
16
|
+
ignoreLog = !isDev;
|
|
17
|
+
}
|
|
18
|
+
dlog.isDev = isDev;
|
|
13
19
|
function convertMsg(str, limit = 5000) {
|
|
14
20
|
if (str == null) {
|
|
15
21
|
return "null";
|
|
@@ -27,6 +33,9 @@ var dlog;
|
|
|
27
33
|
return final.substring(0, limit) + (final.length > limit ? "(trancated)" : "");
|
|
28
34
|
}
|
|
29
35
|
function d(msg, msg2 = null) {
|
|
36
|
+
if (ignoreLog) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
30
39
|
console.log(`[${new Date().toLocaleString()}][DEBUG] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
31
40
|
}
|
|
32
41
|
dlog.d = d;
|
|
@@ -35,15 +44,24 @@ var dlog;
|
|
|
35
44
|
}
|
|
36
45
|
dlog.e = e;
|
|
37
46
|
function i(msg, msg2 = null) {
|
|
47
|
+
if (ignoreLog) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
38
50
|
console.log(`[${new Date().toLocaleString()}][INFO] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
39
51
|
}
|
|
40
52
|
dlog.i = i;
|
|
41
53
|
function s(msg, msg2 = null) {
|
|
54
|
+
if (ignoreLog) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
42
57
|
console.log(`[${new Date().toLocaleString()}][SUCCESS] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
43
58
|
}
|
|
44
59
|
dlog.s = s;
|
|
45
60
|
function ex(e, ignore = true) {
|
|
46
61
|
var _a;
|
|
62
|
+
if (ignoreLog) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
47
65
|
try {
|
|
48
66
|
if (ignore) {
|
|
49
67
|
console.log(`[${new Date().toLocaleString()}][EXCEPTION] ${e.message}. Please check: ${(_a = e.stack) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, 2).join("")})`);
|
|
@@ -56,12 +74,18 @@ var dlog;
|
|
|
56
74
|
}
|
|
57
75
|
dlog.ex = ex;
|
|
58
76
|
function obj(obj, msg = "DEBUG OBJECT") {
|
|
77
|
+
if (ignoreLog) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
59
80
|
console.log(`[${new Date().toLocaleString()}][DEBUG] =========================== ${msg} START ======================`);
|
|
60
81
|
console.log(convertMsg(obj));
|
|
61
82
|
console.log(`[${new Date().toLocaleString()}][DEBUG] =========================== ${msg} END ======================`);
|
|
62
83
|
}
|
|
63
84
|
dlog.obj = obj;
|
|
64
85
|
function map(map) {
|
|
86
|
+
if (ignoreLog) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
65
89
|
console.log("[${new Date().toLocaleString()}]=========================== DEBUG OBJECT START ======================");
|
|
66
90
|
for (let x in map.keys()) {
|
|
67
91
|
console.log(`${JSON.stringify(x)} ==> ${JSON.stringify(map.get(x))}`);
|
package/dist/dlog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlog.js","sourceRoot":"","sources":["../src/dlog.ts"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,uCAAuC;;;;;;AAEvC,4DAA2B;AAE3B,8CAA8C;AAC9C,IAAiB,IAAI,
|
|
1
|
+
{"version":3,"file":"dlog.js","s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6 +5,11 @@ import _ from "underscore";
|
|
|
5
5
|
|
|
6
6
|
//let _log = colorogs(true, true, __filename);
|
|
7
7
|
export namespace dlog {
|
|
8
|
+
let ignoreLog = false;
|
|
9
|
+
// call this function to ignore log in prod
|
|
10
|
+
export function isDev(isDev: boolean) {
|
|
11
|
+
ignoreLog = !isDev;
|
|
12
|
+
}
|
|
8
13
|
function convertMsg(str: any, limit = 5000) {
|
|
9
14
|
if (str == null) {
|
|
10
15
|
return "null";
|
|
@@ -22,18 +27,30 @@ export namespace dlog {
|
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export function d(msg: String, msg2: any = null) {
|
|
30
|
+
if (ignoreLog) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
25
33
|
console.log(`[${new Date().toLocaleString()}][DEBUG] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
26
34
|
}
|
|
27
35
|
export function e(msg: String, msg2: any = null) {
|
|
28
36
|
console.log(`[${new Date().toLocaleString()}][ERROR] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
29
37
|
}
|
|
30
38
|
export function i(msg: String, msg2: any = null) {
|
|
39
|
+
if (ignoreLog) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
31
42
|
console.log(`[${new Date().toLocaleString()}][INFO] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
32
43
|
}
|
|
33
44
|
export function s(msg: String, msg2: any = null) {
|
|
45
|
+
if (ignoreLog) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
34
48
|
console.log(`[${new Date().toLocaleString()}][SUCCESS] ${convertMsg(msg)} ${msg2 ? msg2 : ""} `);
|
|
35
49
|
}
|
|
36
50
|
export function ex(e: Error, ignore = true) {
|
|
51
|
+
if (ignoreLog) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
37
54
|
try {
|
|
38
55
|
if (ignore) {
|
|
39
56
|
console.log(`[${new Date().toLocaleString()}][EXCEPTION] ${e.message}. Please check: ${e.stack?.split("\n").slice(0, 2).join("")})`);
|
|
@@ -44,11 +61,17 @@ export namespace dlog {
|
|
|
44
61
|
} catch (e) {}
|
|
45
62
|
}
|
|
46
63
|
export function obj(obj?: Object, msg: string = "DEBUG OBJECT") {
|
|
64
|
+
if (ignoreLog) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
47
67
|
console.log(`[${new Date().toLocaleString()}][DEBUG] =========================== ${msg} START ======================`);
|
|
48
68
|
console.log(convertMsg(obj));
|
|
49
69
|
console.log(`[${new Date().toLocaleString()}][DEBUG] =========================== ${msg} END ======================`);
|
|
50
70
|
}
|
|
51
71
|
export function map(map: Map<string, any>) {
|
|
72
|
+
if (ignoreLog) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
52
75
|
console.log("[${new Date().toLocaleString()}]=========================== DEBUG OBJECT START ======================");
|
|
53
76
|
for (let x in map.keys()) {
|
|
54
77
|
console.log(`${JSON.stringify(x)} ==> ${JSON.stringify(map.get(x))}`);
|