@yumerijs/core 1.0.15 → 1.0.17
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/logger.d.ts +1 -2
- package/dist/logger.js +7 -8
- package/dist/logger.js.map +1 -1
- package/package.json +2 -2
package/dist/logger.d.ts
CHANGED
package/dist/logger.js
CHANGED
|
@@ -2,28 +2,27 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @time: 2025/03/24 22:35
|
|
4
4
|
* @author: FireGuo
|
|
5
|
-
|
|
6
|
-
**/
|
|
5
|
+
*/
|
|
7
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
8
|
};
|
|
10
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
10
|
exports.Logger = void 0;
|
|
12
|
-
const
|
|
11
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors")); // 引入 ansi-colors
|
|
13
12
|
class Logger {
|
|
14
13
|
constructor(title) {
|
|
15
14
|
this.title = title;
|
|
16
|
-
this.titleColor = this.getRandomColor();
|
|
15
|
+
this.titleColor = this.getRandomColor();
|
|
17
16
|
}
|
|
18
17
|
getRandomColor() {
|
|
19
|
-
const
|
|
20
|
-
const randomIndex = Math.floor(Math.random() *
|
|
21
|
-
return
|
|
18
|
+
const availableColors = [ansi_colors_1.default.red, ansi_colors_1.default.green, ansi_colors_1.default.yellow, ansi_colors_1.default.blue, ansi_colors_1.default.magenta, ansi_colors_1.default.cyan, ansi_colors_1.default.white, ansi_colors_1.default.gray];
|
|
19
|
+
const randomIndex = Math.floor(Math.random() * availableColors.length);
|
|
20
|
+
return availableColors[randomIndex];
|
|
22
21
|
}
|
|
23
22
|
log(level, ...args) {
|
|
24
23
|
const now = new Date();
|
|
25
24
|
const timestamp = `${now.getFullYear()}/${String(now.getMonth() + 1).padStart(2, '0')}/${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
|
26
|
-
console.log(`${timestamp} [${level}] ${this.titleColor(this.title)}`, ...args);
|
|
25
|
+
console.log(`${timestamp} [${level}] ${this.titleColor(this.title)} `, ...args);
|
|
27
26
|
}
|
|
28
27
|
info(...args) {
|
|
29
28
|
this.log('I', ...args);
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,8DAAiC,CAAC,iBAAiB;AAEnD,MAAa,MAAM;IAIjB,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;IAEO,cAAc;QACpB,MAAM,eAAe,GAAG,CAAC,qBAAM,CAAC,GAAG,EAAE,qBAAM,CAAC,KAAK,EAAE,qBAAM,CAAC,MAAM,EAAE,qBAAM,CAAC,IAAI,EAAE,qBAAM,CAAC,OAAO,EAAE,qBAAM,CAAC,IAAI,EAAE,qBAAM,CAAC,KAAK,EAAE,qBAAM,CAAC,IAAI,CAAC,CAAC;QACvI,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACvE,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAEO,GAAG,CAAC,KAAa,EAAE,GAAG,IAAW;QACvC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QAC1N,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,KAAK,KAAK,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;CACF;AAhCD,wBAgCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yumerijs/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Core module for yumeri",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@types/chalk": "^2.2.4",
|
|
35
|
-
"
|
|
35
|
+
"ansi-colors": "^4.1.3",
|
|
36
36
|
"chokidar": "^4.0.3",
|
|
37
37
|
"js-sha256": "^0.11.0",
|
|
38
38
|
"js-yaml": "^4.1.0"
|