diginext-utils 2.0.25 → 2.0.26
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/console/log.d.ts +12 -12
- package/dist/console/log.js +10 -5
- package/dist/console/log.js.map +1 -1
- package/esm/console/log.d.ts +12 -12
- package/esm/console/log.js +10 -5
- package/esm/console/log.js.map +1 -1
- package/package.json +1 -1
- package/src/console/log.ts +10 -5
package/dist/console/log.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare const log: (...msg: any) =>
|
|
2
|
-
export declare const logFull: (data?: {}) =>
|
|
3
|
-
export declare const logRes: (res: any, ...msg: any[]) =>
|
|
4
|
-
export declare const logError: (...msg: any[]) =>
|
|
5
|
-
export declare const logWarn: (...msg: any[]) =>
|
|
6
|
-
export declare const logSuccess: (...msg: any[]) =>
|
|
1
|
+
export declare const log: (...msg: any) => any;
|
|
2
|
+
export declare const logFull: (data?: {}) => {};
|
|
3
|
+
export declare const logRes: (res: any, ...msg: any[]) => any[];
|
|
4
|
+
export declare const logError: (...msg: any[]) => any[];
|
|
5
|
+
export declare const logWarn: (...msg: any[]) => any[];
|
|
6
|
+
export declare const logSuccess: (...msg: any[]) => any[];
|
|
7
7
|
declare const xlog: {
|
|
8
|
-
log: (...msg: any) =>
|
|
9
|
-
logFull: (data?: {}) =>
|
|
10
|
-
logRes: (res: any, ...msg: any[]) =>
|
|
11
|
-
logError: (...msg: any[]) =>
|
|
12
|
-
logWarn: (...msg: any[]) =>
|
|
13
|
-
logSuccess: (...msg: any[]) =>
|
|
8
|
+
log: (...msg: any) => any;
|
|
9
|
+
logFull: (data?: {}) => {};
|
|
10
|
+
logRes: (res: any, ...msg: any[]) => any[];
|
|
11
|
+
logError: (...msg: any[]) => any[];
|
|
12
|
+
logWarn: (...msg: any[]) => any[];
|
|
13
|
+
logSuccess: (...msg: any[]) => any[];
|
|
14
14
|
};
|
|
15
15
|
export default xlog;
|
package/dist/console/log.js
CHANGED
|
@@ -7,11 +7,13 @@ exports.logSuccess = exports.logWarn = exports.logError = exports.logRes = expor
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const log = (...msg) => {
|
|
10
|
-
console.log(chalk_1.default.
|
|
10
|
+
console.log(chalk_1.default.bgBlue.white(`[LOGGING ${(0, dayjs_1.default)().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
11
|
+
return msg;
|
|
11
12
|
};
|
|
12
13
|
exports.log = log;
|
|
13
14
|
const logFull = (data = {}) => {
|
|
14
15
|
console.dir(data, { depth: null, colors: true, maxArrayLength: null });
|
|
16
|
+
return data;
|
|
15
17
|
};
|
|
16
18
|
exports.logFull = logFull;
|
|
17
19
|
const logRes = (res, ...msg) => {
|
|
@@ -19,20 +21,23 @@ const logRes = (res, ...msg) => {
|
|
|
19
21
|
/**
|
|
20
22
|
* res.locals.req = Express Request
|
|
21
23
|
*/
|
|
22
|
-
// console.log(res.locals.req);
|
|
23
24
|
console.warn(chalk_1.default.blue(`[${res.statusCode}] ${((_a = res.locals.req) === null || _a === void 0 ? void 0 : _a.originalUrl) || "UNKNOWN_PATH"} >> ${(_b = res.locals.req) === null || _b === void 0 ? void 0 : _b.method} >>`), ...msg);
|
|
25
|
+
return msg;
|
|
24
26
|
};
|
|
25
27
|
exports.logRes = logRes;
|
|
26
28
|
const logError = (...msg) => {
|
|
27
|
-
console.error(chalk_1.default.bgRed
|
|
29
|
+
console.error(chalk_1.default.bgRed.white(`[ERROR ${(0, dayjs_1.default)().format("YYYY-MM-DD HH:mm:ss")}]`), chalk_1.default.red(...msg));
|
|
30
|
+
return msg;
|
|
28
31
|
};
|
|
29
32
|
exports.logError = logError;
|
|
30
33
|
const logWarn = (...msg) => {
|
|
31
|
-
console.warn(chalk_1.default.
|
|
34
|
+
console.warn(chalk_1.default.bgYellow.black(`[WARNING ${(0, dayjs_1.default)().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
35
|
+
return msg;
|
|
32
36
|
};
|
|
33
37
|
exports.logWarn = logWarn;
|
|
34
38
|
const logSuccess = (...msg) => {
|
|
35
|
-
console.info(chalk_1.default.
|
|
39
|
+
console.info(chalk_1.default.bgGreen.black(`[SUCCESS ${(0, dayjs_1.default)().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
40
|
+
return msg;
|
|
36
41
|
};
|
|
37
42
|
exports.logSuccess = logSuccess;
|
|
38
43
|
const xlog = { log: exports.log, logFull: exports.logFull, logRes: exports.logRes, logError: exports.logError, logWarn: exports.logWarn, logSuccess: exports.logSuccess };
|
package/dist/console/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/console/log.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAEnB,MAAM,GAAG,GAAG,CAAC,GAAG,GAAQ,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/console/log.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAEnB,MAAM,GAAG,GAAG,CAAC,GAAG,GAAQ,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAA,eAAK,GAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IAC9F,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,GAAG,OAGd;AAEK,MAAM,OAAO,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE;IACpC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EA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AK,GAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IAChG,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEF,MAAM,IAAI,GAAG,EAAE,GAAG,EAAH,WAAG,EAAE,OAAO,EAAP,eAAO,EAAE,MAAM,EAAN,cAAM,EAAE,QAAQ,EAAR,gBAAQ,EAAE,OAAO,EAAP,eAAO,EAAE,UAAU,EAAV,kBAAU,EAAE,CAAC;AAErE,kBAAe,IAAI,CAAC"}
|
package/esm/console/log.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare const log: (...msg: any) =>
|
|
2
|
-
export declare const logFull: (data?: {}) =>
|
|
3
|
-
export declare const logRes: (res: any, ...msg: any[]) =>
|
|
4
|
-
export declare const logError: (...msg: any[]) =>
|
|
5
|
-
export declare const logWarn: (...msg: any[]) =>
|
|
6
|
-
export declare const logSuccess: (...msg: any[]) =>
|
|
1
|
+
export declare const log: (...msg: any) => any;
|
|
2
|
+
export declare const logFull: (data?: {}) => {};
|
|
3
|
+
export declare const logRes: (res: any, ...msg: any[]) => any[];
|
|
4
|
+
export declare const logError: (...msg: any[]) => any[];
|
|
5
|
+
export declare const logWarn: (...msg: any[]) => any[];
|
|
6
|
+
export declare const logSuccess: (...msg: any[]) => any[];
|
|
7
7
|
declare const xlog: {
|
|
8
|
-
log: (...msg: any) =>
|
|
9
|
-
logFull: (data?: {}) =>
|
|
10
|
-
logRes: (res: any, ...msg: any[]) =>
|
|
11
|
-
logError: (...msg: any[]) =>
|
|
12
|
-
logWarn: (...msg: any[]) =>
|
|
13
|
-
logSuccess: (...msg: any[]) =>
|
|
8
|
+
log: (...msg: any) => any;
|
|
9
|
+
logFull: (data?: {}) => {};
|
|
10
|
+
logRes: (res: any, ...msg: any[]) => any[];
|
|
11
|
+
logError: (...msg: any[]) => any[];
|
|
12
|
+
logWarn: (...msg: any[]) => any[];
|
|
13
|
+
logSuccess: (...msg: any[]) => any[];
|
|
14
14
|
};
|
|
15
15
|
export default xlog;
|
package/esm/console/log.js
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
export const log = (...msg) => {
|
|
4
|
-
console.log(chalk.
|
|
4
|
+
console.log(chalk.bgBlue.white(`[LOGGING ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
5
|
+
return msg;
|
|
5
6
|
};
|
|
6
7
|
export const logFull = (data = {}) => {
|
|
7
8
|
console.dir(data, { depth: null, colors: true, maxArrayLength: null });
|
|
9
|
+
return data;
|
|
8
10
|
};
|
|
9
11
|
export const logRes = (res, ...msg) => {
|
|
10
12
|
var _a, _b;
|
|
11
13
|
/**
|
|
12
14
|
* res.locals.req = Express Request
|
|
13
15
|
*/
|
|
14
|
-
// console.log(res.locals.req);
|
|
15
16
|
console.warn(chalk.blue(`[${res.statusCode}] ${((_a = res.locals.req) === null || _a === void 0 ? void 0 : _a.originalUrl) || "UNKNOWN_PATH"} >> ${(_b = res.locals.req) === null || _b === void 0 ? void 0 : _b.method} >>`), ...msg);
|
|
17
|
+
return msg;
|
|
16
18
|
};
|
|
17
19
|
export const logError = (...msg) => {
|
|
18
|
-
console.error(chalk.bgRed
|
|
20
|
+
console.error(chalk.bgRed.white(`[ERROR ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), chalk.red(...msg));
|
|
21
|
+
return msg;
|
|
19
22
|
};
|
|
20
23
|
export const logWarn = (...msg) => {
|
|
21
|
-
console.warn(chalk.
|
|
24
|
+
console.warn(chalk.bgYellow.black(`[WARNING ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
25
|
+
return msg;
|
|
22
26
|
};
|
|
23
27
|
export const logSuccess = (...msg) => {
|
|
24
|
-
console.info(chalk.
|
|
28
|
+
console.info(chalk.bgGreen.black(`[SUCCESS ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
29
|
+
return msg;
|
|
25
30
|
};
|
|
26
31
|
const xlog = { log, logFull, logRes, logError, logWarn, logSuccess };
|
|
27
32
|
export default xlog;
|
package/esm/console/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/console/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAQ,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/console/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAQ,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IAC9F,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE;IACpC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAQ,EAAE,GAAG,GAAU,EAAE,EAAE;;IACjD;;OAEG;IACH,OAAO,CAAC,IAAI,CAA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}
|
package/package.json
CHANGED
package/src/console/log.ts
CHANGED
|
@@ -2,31 +2,36 @@ import chalk from "chalk";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
|
|
4
4
|
export const log = (...msg: any) => {
|
|
5
|
-
console.log(chalk.
|
|
5
|
+
console.log(chalk.bgBlue.white(`[LOGGING ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
6
|
+
return msg;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export const logFull = (data = {}) => {
|
|
9
10
|
console.dir(data, { depth: null, colors: true, maxArrayLength: null });
|
|
11
|
+
return data;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export const logRes = (res: any, ...msg: any[]) => {
|
|
13
15
|
/**
|
|
14
16
|
* res.locals.req = Express Request
|
|
15
17
|
*/
|
|
16
|
-
// console.log(res.locals.req);
|
|
17
18
|
console.warn(chalk.blue(`[${res.statusCode}] ${res.locals.req?.originalUrl || "UNKNOWN_PATH"} >> ${res.locals.req?.method} >>`), ...msg);
|
|
19
|
+
return msg;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export const logError = (...msg: any[]) => {
|
|
21
|
-
console.error(chalk.bgRed
|
|
23
|
+
console.error(chalk.bgRed.white(`[ERROR ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), chalk.red(...msg));
|
|
24
|
+
return msg;
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
export const logWarn = (...msg: any[]) => {
|
|
25
|
-
console.warn(chalk.
|
|
28
|
+
console.warn(chalk.bgYellow.black(`[WARNING ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
29
|
+
return msg;
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
export const logSuccess = (...msg: any[]) => {
|
|
29
|
-
console.info(chalk.
|
|
33
|
+
console.info(chalk.bgGreen.black(`[SUCCESS ${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`), ...msg);
|
|
34
|
+
return msg;
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
const xlog = { log, logFull, logRes, logError, logWarn, logSuccess };
|