@wsurface/debug 2.0.3 → 2.0.6
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/LICENSE +21 -0
- package/README.md +5 -5
- package/package.json +30 -16
- package/src/cjs/index.cjs +0 -1
- package/src/cjs/modules/logger.cjs +5 -28
- package/src/esm/index.mjs +0 -1
- package/src/esm/modules/logger.mjs +5 -28
- package/LICENSE.txt +0 -21
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nuneswip
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/nuneswip/
|
|
11
|
+
<a href="https://github.com/nuneswip/surface-debug">
|
|
12
12
|
<img src="https://img.shields.io/badge/GitHub-Repository-181717?style=for-the-badge&logo=github&logoColor=white" />
|
|
13
13
|
</a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/@wsurface/debug">
|
|
15
15
|
<img src="https://img.shields.io/npm/v/@wsurface/debug?style=for-the-badge&logo=npm" />
|
|
16
16
|
</a>
|
|
17
|
-
<a href="https://
|
|
18
|
-
<img src="https://img.shields.io/badge/license-
|
|
17
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
18
|
+
<img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" />
|
|
19
19
|
</a>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
@@ -64,7 +64,7 @@ pnpm add @wsurface/debug
|
|
|
64
64
|
</p>
|
|
65
65
|
|
|
66
66
|
<p align="center">
|
|
67
|
-
<a href="https://
|
|
67
|
+
<a href="https://github.com/nuneswip/wsurface-debug/tree/main/docs">
|
|
68
68
|
View Documentation
|
|
69
69
|
</a>
|
|
70
70
|
</p>
|
|
@@ -72,6 +72,6 @@ pnpm add @wsurface/debug
|
|
|
72
72
|
<hr/>
|
|
73
73
|
|
|
74
74
|
<p align="center">
|
|
75
|
-
Distributed under <a href="https://
|
|
75
|
+
Distributed under <a href="https://opensource.org/licenses/MIT">MIT License</a><br/>
|
|
76
76
|
by nuneswip.
|
|
77
77
|
</p>
|
package/package.json
CHANGED
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wsurface/debug",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "A simple and powerful logger for your project.",
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
7
|
-
},
|
|
8
5
|
"keywords": [
|
|
9
6
|
"debug",
|
|
10
|
-
"
|
|
11
|
-
"log",
|
|
7
|
+
"logger",
|
|
12
8
|
"logging",
|
|
13
9
|
"console",
|
|
14
|
-
"logger",
|
|
15
|
-
"nodejs",
|
|
16
|
-
"shell",
|
|
17
|
-
"terminal",
|
|
18
10
|
"cli",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
11
|
+
"terminal",
|
|
12
|
+
"nodejs",
|
|
13
|
+
"chalk",
|
|
14
|
+
"colors",
|
|
15
|
+
"ansi",
|
|
16
|
+
"icons",
|
|
17
|
+
"emoji",
|
|
18
|
+
"timestamp",
|
|
19
|
+
"theme",
|
|
20
|
+
"timer",
|
|
21
|
+
"progress",
|
|
22
|
+
"group",
|
|
23
|
+
"box",
|
|
24
|
+
"json",
|
|
25
|
+
"dev-tools"
|
|
21
26
|
],
|
|
27
|
+
"author": "nuneswip",
|
|
28
|
+
"license": "MIT",
|
|
22
29
|
"type": "module",
|
|
23
|
-
"main": "./src/
|
|
30
|
+
"main": "./src/esm/index.mjs",
|
|
24
31
|
"exports": {
|
|
25
32
|
"import": "./src/esm/index.mjs",
|
|
26
33
|
"require": "./src/cjs/index.cjs"
|
|
27
34
|
},
|
|
28
|
-
"files": [
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
"files": [
|
|
36
|
+
"src",
|
|
37
|
+
"package.json",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
31
45
|
"dependencies": {
|
|
32
46
|
"chalk": "^5.4.1"
|
|
33
47
|
}
|
package/src/cjs/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const DEFAULT_THEME = {
|
|
|
16
16
|
conn: "blue"
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const ICONS = {
|
|
20
20
|
info: "ℹ",
|
|
21
21
|
warn: "⚠",
|
|
22
22
|
error: "✖",
|
|
@@ -32,7 +32,6 @@ class Logger {
|
|
|
32
32
|
icons: true,
|
|
33
33
|
tag: true,
|
|
34
34
|
theme: DEFAULT_THEME,
|
|
35
|
-
iconSet: DEFAULT_ICONS,
|
|
36
35
|
...options
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -68,25 +67,13 @@ class Logger {
|
|
|
68
67
|
if (!start) return;
|
|
69
68
|
|
|
70
69
|
const duration = Date.now() - start;
|
|
70
|
+
|
|
71
71
|
this.info(`⏱ ${label}: ${duration}ms`);
|
|
72
72
|
this.timers.delete(label);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
getIcon(level, options) {
|
|
78
|
-
if (!options.icons) return "";
|
|
79
|
-
|
|
80
|
-
const iconSet = {
|
|
81
|
-
...DEFAULT_ICONS,
|
|
82
|
-
...options.iconSet
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const icon = iconSet[level];
|
|
86
|
-
|
|
87
|
-
return icon ? icon + " " : "";
|
|
88
|
-
}
|
|
89
|
-
|
|
90
77
|
createMode(options) {
|
|
91
78
|
const mode = {};
|
|
92
79
|
|
|
@@ -103,8 +90,7 @@ class Logger {
|
|
|
103
90
|
|
|
104
91
|
this.levels.forEach(level => {
|
|
105
92
|
box[level] = msg => {
|
|
106
|
-
const
|
|
107
|
-
const text = ` ${icon}${msg} `;
|
|
93
|
+
const text = ` ${ICONS[level]} ${msg} `;
|
|
108
94
|
const line = "─".repeat(text.length);
|
|
109
95
|
|
|
110
96
|
console.log(`┌${line}┐`);
|
|
@@ -140,16 +126,7 @@ class Logger {
|
|
|
140
126
|
}
|
|
141
127
|
|
|
142
128
|
setOptions(options) {
|
|
143
|
-
this.options = {
|
|
144
|
-
...this.options,
|
|
145
|
-
...options,
|
|
146
|
-
iconSet: options.iconSet
|
|
147
|
-
? {
|
|
148
|
-
...this.options.iconSet,
|
|
149
|
-
...options.iconSet
|
|
150
|
-
}
|
|
151
|
-
: this.options.iconSet
|
|
152
|
-
};
|
|
129
|
+
this.options = { ...this.options, ...options };
|
|
153
130
|
}
|
|
154
131
|
|
|
155
132
|
formatTimestamp(enabled) {
|
|
@@ -174,7 +151,7 @@ class Logger {
|
|
|
174
151
|
|
|
175
152
|
const color = c[theme[level]] || c.white;
|
|
176
153
|
|
|
177
|
-
const icon =
|
|
154
|
+
const icon = merged.icons ? `${ICONS[level]} ` : "";
|
|
178
155
|
|
|
179
156
|
const timestamp = this.formatTimestamp(merged.timestamp);
|
|
180
157
|
|
package/src/esm/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ const DEFAULT_THEME = {
|
|
|
11
11
|
conn: "blue"
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const ICONS = {
|
|
15
15
|
info: "ℹ",
|
|
16
16
|
warn: "⚠",
|
|
17
17
|
error: "✖",
|
|
@@ -27,7 +27,6 @@ class Logger {
|
|
|
27
27
|
icons: true,
|
|
28
28
|
tag: true,
|
|
29
29
|
theme: DEFAULT_THEME,
|
|
30
|
-
iconSet: DEFAULT_ICONS,
|
|
31
30
|
...options
|
|
32
31
|
};
|
|
33
32
|
|
|
@@ -42,6 +41,7 @@ class Logger {
|
|
|
42
41
|
});
|
|
43
42
|
|
|
44
43
|
this.box = this.createBox();
|
|
44
|
+
|
|
45
45
|
this.json = this.createJSON();
|
|
46
46
|
|
|
47
47
|
this.group = {
|
|
@@ -70,19 +70,6 @@ class Logger {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
getIcon(level, options) {
|
|
74
|
-
if (!options.icons) return "";
|
|
75
|
-
|
|
76
|
-
const iconSet = {
|
|
77
|
-
...DEFAULT_ICONS,
|
|
78
|
-
...options.iconSet
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const icon = iconSet[level];
|
|
82
|
-
|
|
83
|
-
return icon ? icon + " " : "";
|
|
84
|
-
}
|
|
85
|
-
|
|
86
73
|
createMode(options) {
|
|
87
74
|
const mode = {};
|
|
88
75
|
this.levels.forEach(level => {
|
|
@@ -97,8 +84,7 @@ class Logger {
|
|
|
97
84
|
|
|
98
85
|
this.levels.forEach(level => {
|
|
99
86
|
box[level] = msg => {
|
|
100
|
-
const
|
|
101
|
-
const text = ` ${icon}${msg} `;
|
|
87
|
+
const text = ` ${ICONS[level]} ${msg} `;
|
|
102
88
|
const line = "─".repeat(text.length);
|
|
103
89
|
|
|
104
90
|
console.log(`┌${line}┐`);
|
|
@@ -134,16 +120,7 @@ class Logger {
|
|
|
134
120
|
}
|
|
135
121
|
|
|
136
122
|
setOptions(options) {
|
|
137
|
-
this.options = {
|
|
138
|
-
...this.options,
|
|
139
|
-
...options,
|
|
140
|
-
iconSet: options.iconSet
|
|
141
|
-
? {
|
|
142
|
-
...this.options.iconSet,
|
|
143
|
-
...options.iconSet
|
|
144
|
-
}
|
|
145
|
-
: this.options.iconSet
|
|
146
|
-
};
|
|
123
|
+
this.options = { ...this.options, ...options };
|
|
147
124
|
}
|
|
148
125
|
|
|
149
126
|
formatTimestamp(enabled) {
|
|
@@ -166,7 +143,7 @@ class Logger {
|
|
|
166
143
|
|
|
167
144
|
const color = chalk[theme[level]] || chalk.white;
|
|
168
145
|
|
|
169
|
-
const icon =
|
|
146
|
+
const icon = merged.icons ? `${ICONS[level]} ` : "";
|
|
170
147
|
|
|
171
148
|
const timestamp = this.formatTimestamp(merged.timestamp);
|
|
172
149
|
|
package/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Licença: Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)
|
|
2
|
-
|
|
3
|
-
Você tem permissão para compartilhar, usar e distribuir este software,
|
|
4
|
-
inclusive para fins comerciais, contanto que:
|
|
5
|
-
- Atribua crédito apropriado ao autor original (Pedro Nunes).
|
|
6
|
-
- Não modifique, edite ou crie derivados deste software.
|
|
7
|
-
|
|
8
|
-
Mais informações:
|
|
9
|
-
https://creativecommons.org/licenses/by-nd/4.0/
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
License: Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)
|
|
14
|
-
|
|
15
|
-
You are allowed to share, use, and distribute this software,
|
|
16
|
-
including for commercial purposes, provided that:
|
|
17
|
-
- Proper credit is given to the original author (Pedro Nunes).
|
|
18
|
-
- You do not modify, edit, or create derivative works based on this software.
|
|
19
|
-
|
|
20
|
-
More information:
|
|
21
|
-
https://creativecommons.org/licenses/by-nd/4.0/
|