@mks2508/better-logger 0.0.1
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/.claude/settings.local.json +13 -0
- package/CLAUDE.md +113 -0
- package/dist/assets/index-DxvJByYN.js +183 -0
- package/dist/index.html +334 -0
- package/dist/vite.svg +1 -0
- package/index.html +334 -0
- package/package.json +35 -0
- package/public/vite.svg +1 -0
- package/src/Logger.ts +577 -0
- package/src/Logger.ts.backup +1684 -0
- package/src/cli/CommandProcessor.ts +77 -0
- package/src/cli/commands/ConfigCommand.ts +93 -0
- package/src/cli/commands/ExportCommand.ts +271 -0
- package/src/cli/commands/StatusCommand.ts +111 -0
- package/src/cli/commands/ThemeCommand.ts +88 -0
- package/src/cli/help.ts +127 -0
- package/src/cli/index.ts +59 -0
- package/src/constants.ts +89 -0
- package/src/example.ts +88 -0
- package/src/handlers/AnalyticsLogHandler.ts +22 -0
- package/src/handlers/ExportLogHandler.ts +447 -0
- package/src/handlers/FileLogHandler.ts +30 -0
- package/src/handlers/RemoteLogHandler.ts +42 -0
- package/src/handlers/index.ts +8 -0
- package/src/index.ts +122 -0
- package/src/main.ts +126 -0
- package/src/style.css +96 -0
- package/src/styling/StyleBuilder.ts +305 -0
- package/src/styling/banners.ts +168 -0
- package/src/styling/index.ts +12 -0
- package/src/styling/themes.ts +235 -0
- package/src/types/core.ts +80 -0
- package/src/types/handlers.ts +95 -0
- package/src/types/index.ts +29 -0
- package/src/typescript.svg +1 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/output.ts +127 -0
- package/src/utils/stackTrace.ts +66 -0
- package/src/utils/timestamps.ts +80 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +24 -0
package/src/main.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
debug,
|
|
3
|
+
info,
|
|
4
|
+
warn,
|
|
5
|
+
error,
|
|
6
|
+
success,
|
|
7
|
+
critical,
|
|
8
|
+
table,
|
|
9
|
+
group,
|
|
10
|
+
groupEnd,
|
|
11
|
+
time,
|
|
12
|
+
timeEnd,
|
|
13
|
+
trace,
|
|
14
|
+
createScopedLogger,
|
|
15
|
+
cli,
|
|
16
|
+
setTheme,
|
|
17
|
+
} from './Logger.ts';
|
|
18
|
+
|
|
19
|
+
// The init banner from Logger.ts is displayed automatically on import.
|
|
20
|
+
console.log("Advanced Logger script loaded. Test functions are now available.");
|
|
21
|
+
|
|
22
|
+
function testDebug() {
|
|
23
|
+
debug("This is a debug message.", { user: "test", id: 123 });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function testInfo() {
|
|
27
|
+
info("This is an info message with an object.", { data: "payload" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function testWarn() {
|
|
31
|
+
warn("This is a warning message about a deprecated API.");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function testError() {
|
|
35
|
+
error("This is an error message.", new Error("Failed to fetch resource."));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function testSuccess() {
|
|
39
|
+
success("Operation completed successfully.");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function testCritical() {
|
|
43
|
+
critical("This is a CRITICAL message. System integrity compromised!");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function testTable() {
|
|
47
|
+
table([
|
|
48
|
+
{ feature: "Debug Log", status: "Implemented", priority: "Low" },
|
|
49
|
+
{ feature: "Info Log", status: "Implemented", priority: "Medium" },
|
|
50
|
+
{ feature: "Warning Log", status: "Implemented", priority: "High" },
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function testGrouping() {
|
|
55
|
+
group("User Authentication Flow", true); // Start collapsed
|
|
56
|
+
info("User 'testuser' attempting to log in...");
|
|
57
|
+
warn("Password nearing expiration.");
|
|
58
|
+
success("Login successful.");
|
|
59
|
+
groupEnd();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function testTiming() {
|
|
63
|
+
time("dataProcessing");
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
timeEnd("dataProcessing");
|
|
66
|
+
}, 750); // Simulate a 750ms operation
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function testScopedLogger() {
|
|
70
|
+
info("Demonstrating scoped loggers...");
|
|
71
|
+
const apiLogger = createScopedLogger("API");
|
|
72
|
+
apiLogger.info("Fetching user data...");
|
|
73
|
+
const uiLogger = createScopedLogger("UI");
|
|
74
|
+
uiLogger.debug("Rendering user profile component.");
|
|
75
|
+
apiLogger.success("User data fetched successfully.");
|
|
76
|
+
apiLogger.error("Failed to update settings.");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function testTrace() {
|
|
80
|
+
function innerFunction() {
|
|
81
|
+
function deepFunction() {
|
|
82
|
+
trace("Trace from a deeply nested function.");
|
|
83
|
+
}
|
|
84
|
+
deepFunction();
|
|
85
|
+
}
|
|
86
|
+
innerFunction();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function testAllFeatures() {
|
|
90
|
+
group("š Demonstrating All Logger Features");
|
|
91
|
+
testDebug();
|
|
92
|
+
testInfo();
|
|
93
|
+
testWarn();
|
|
94
|
+
testError();
|
|
95
|
+
testSuccess();
|
|
96
|
+
testCritical();
|
|
97
|
+
testTable();
|
|
98
|
+
testGrouping();
|
|
99
|
+
testTiming();
|
|
100
|
+
testScopedLogger();
|
|
101
|
+
testTrace();
|
|
102
|
+
groupEnd();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Expose functions to global scope for onclick attributes in index.html
|
|
106
|
+
if (typeof window !== 'undefined') {
|
|
107
|
+
(window as any).testDebug = testDebug;
|
|
108
|
+
(window as any).testInfo = testInfo;
|
|
109
|
+
(window as any).testWarn = testWarn;
|
|
110
|
+
(window as any).testError = testError;
|
|
111
|
+
(window as any).testSuccess = testSuccess;
|
|
112
|
+
(window as any).testCritical = testCritical;
|
|
113
|
+
(window as any).testTable = testTable;
|
|
114
|
+
(window as any).testGrouping = testGrouping;
|
|
115
|
+
(window as any).testTiming = testTiming;
|
|
116
|
+
(window as any).testScopedLogger = testScopedLogger;
|
|
117
|
+
(window as any).testTrace = testTrace;
|
|
118
|
+
(window as any).testAllFeatures = testAllFeatures;
|
|
119
|
+
|
|
120
|
+
// Expose CLI functions globally
|
|
121
|
+
(window as any).cli = cli;
|
|
122
|
+
(window as any).setTheme = setTheme;
|
|
123
|
+
|
|
124
|
+
// Display CLI usage info
|
|
125
|
+
console.log('%cš Logger CLI Available! Try: cli("/help")', 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 8px 12px; border-radius: 4px; font-weight: bold;');
|
|
126
|
+
}
|
package/src/style.css
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #646cff;
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: #535bf2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
place-items: center;
|
|
29
|
+
min-width: 320px;
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 3.2em;
|
|
35
|
+
line-height: 1.1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#app {
|
|
39
|
+
max-width: 1280px;
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
padding: 2rem;
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.logo {
|
|
46
|
+
height: 6em;
|
|
47
|
+
padding: 1.5em;
|
|
48
|
+
will-change: filter;
|
|
49
|
+
transition: filter 300ms;
|
|
50
|
+
}
|
|
51
|
+
.logo:hover {
|
|
52
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
53
|
+
}
|
|
54
|
+
.logo.vanilla:hover {
|
|
55
|
+
filter: drop-shadow(0 0 2em #3178c6aa);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.card {
|
|
59
|
+
padding: 2em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.read-the-docs {
|
|
63
|
+
color: #888;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
button {
|
|
67
|
+
border-radius: 8px;
|
|
68
|
+
border: 1px solid transparent;
|
|
69
|
+
padding: 0.6em 1.2em;
|
|
70
|
+
font-size: 1em;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
background-color: #1a1a1a;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
transition: border-color 0.25s;
|
|
76
|
+
}
|
|
77
|
+
button:hover {
|
|
78
|
+
border-color: #646cff;
|
|
79
|
+
}
|
|
80
|
+
button:focus,
|
|
81
|
+
button:focus-visible {
|
|
82
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (prefers-color-scheme: light) {
|
|
86
|
+
:root {
|
|
87
|
+
color: #213547;
|
|
88
|
+
background-color: #ffffff;
|
|
89
|
+
}
|
|
90
|
+
a:hover {
|
|
91
|
+
color: #747bff;
|
|
92
|
+
}
|
|
93
|
+
button {
|
|
94
|
+
background-color: #f9f9f9;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview StyleBuilder class for Advanced Logger
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Utility class for creating dynamic console styles with method chaining
|
|
7
|
+
*/
|
|
8
|
+
export class StyleBuilder {
|
|
9
|
+
private styles: string[] = [];
|
|
10
|
+
|
|
11
|
+
constructor(baseStyle = '') {
|
|
12
|
+
if (baseStyle) this.styles.push(baseStyle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Add background color or gradient
|
|
17
|
+
*/
|
|
18
|
+
bg(background: string): StyleBuilder {
|
|
19
|
+
this.styles.push(`background: ${background}`);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Add text color
|
|
25
|
+
*/
|
|
26
|
+
color(color: string): StyleBuilder {
|
|
27
|
+
this.styles.push(`color: ${color}`);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Add border styling
|
|
33
|
+
*/
|
|
34
|
+
border(border: string): StyleBuilder {
|
|
35
|
+
this.styles.push(`border: ${border}`);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Add box shadow
|
|
41
|
+
*/
|
|
42
|
+
shadow(shadow: string): StyleBuilder {
|
|
43
|
+
this.styles.push(`box-shadow: ${shadow}`);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Add padding
|
|
49
|
+
*/
|
|
50
|
+
padding(padding: string): StyleBuilder {
|
|
51
|
+
this.styles.push(`padding: ${padding}`);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Add margin
|
|
57
|
+
*/
|
|
58
|
+
margin(margin: string): StyleBuilder {
|
|
59
|
+
this.styles.push(`margin: ${margin}`);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Add border radius
|
|
65
|
+
*/
|
|
66
|
+
rounded(radius: string = '4px'): StyleBuilder {
|
|
67
|
+
this.styles.push(`border-radius: ${radius}`);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Add font weight
|
|
73
|
+
*/
|
|
74
|
+
bold(): StyleBuilder {
|
|
75
|
+
this.styles.push('font-weight: bold');
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Add font styling
|
|
81
|
+
*/
|
|
82
|
+
font(font: string): StyleBuilder {
|
|
83
|
+
this.styles.push(`font-family: ${font}`);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Add font size
|
|
89
|
+
*/
|
|
90
|
+
size(size: string): StyleBuilder {
|
|
91
|
+
this.styles.push(`font-size: ${size}`);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Add line height
|
|
97
|
+
*/
|
|
98
|
+
lineHeight(height: string): StyleBuilder {
|
|
99
|
+
this.styles.push(`line-height: ${height}`);
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Add text decoration
|
|
105
|
+
*/
|
|
106
|
+
underline(): StyleBuilder {
|
|
107
|
+
this.styles.push('text-decoration: underline');
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Add text transform
|
|
113
|
+
*/
|
|
114
|
+
uppercase(): StyleBuilder {
|
|
115
|
+
this.styles.push('text-transform: uppercase');
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Add opacity
|
|
121
|
+
*/
|
|
122
|
+
opacity(value: number): StyleBuilder {
|
|
123
|
+
this.styles.push(`opacity: ${value}`);
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Add display property
|
|
129
|
+
*/
|
|
130
|
+
display(value: string): StyleBuilder {
|
|
131
|
+
this.styles.push(`display: ${value}`);
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Add position property
|
|
137
|
+
*/
|
|
138
|
+
position(value: string): StyleBuilder {
|
|
139
|
+
this.styles.push(`position: ${value}`);
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Add transform property
|
|
145
|
+
*/
|
|
146
|
+
transform(value: string): StyleBuilder {
|
|
147
|
+
this.styles.push(`transform: ${value}`);
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Add animation property
|
|
153
|
+
*/
|
|
154
|
+
animation(value: string): StyleBuilder {
|
|
155
|
+
this.styles.push(`animation: ${value}`);
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Add transition property
|
|
161
|
+
*/
|
|
162
|
+
transition(value: string): StyleBuilder {
|
|
163
|
+
this.styles.push(`transition: ${value}`);
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Add cursor property
|
|
169
|
+
*/
|
|
170
|
+
cursor(value: string): StyleBuilder {
|
|
171
|
+
this.styles.push(`cursor: ${value}`);
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Add any custom CSS property
|
|
177
|
+
*/
|
|
178
|
+
custom(property: string, value: string): StyleBuilder {
|
|
179
|
+
this.styles.push(`${property}: ${value}`);
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Add any CSS property (alias for custom)
|
|
185
|
+
*/
|
|
186
|
+
css(property: string, value: string): StyleBuilder {
|
|
187
|
+
return this.custom(property, value);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Build the final CSS string
|
|
192
|
+
*/
|
|
193
|
+
build(): string {
|
|
194
|
+
return this.styles.join('; ');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Clear all styles and start fresh
|
|
199
|
+
*/
|
|
200
|
+
clear(): StyleBuilder {
|
|
201
|
+
this.styles = [];
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Clone this StyleBuilder with the same styles
|
|
207
|
+
*/
|
|
208
|
+
clone(): StyleBuilder {
|
|
209
|
+
const cloned = new StyleBuilder();
|
|
210
|
+
cloned.styles = [...this.styles];
|
|
211
|
+
return cloned;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Merge another StyleBuilder's styles into this one
|
|
216
|
+
*/
|
|
217
|
+
merge(other: StyleBuilder): StyleBuilder {
|
|
218
|
+
this.styles.push(...other.styles);
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Proxy-based dynamic styler for chainable console styling
|
|
225
|
+
*/
|
|
226
|
+
function createStyler(): any {
|
|
227
|
+
const builder = new StyleBuilder();
|
|
228
|
+
return new Proxy(builder, {
|
|
229
|
+
get(target: StyleBuilder, prop: string) {
|
|
230
|
+
if (prop in target) {
|
|
231
|
+
const method = (target as any)[prop];
|
|
232
|
+
if (typeof method === 'function') {
|
|
233
|
+
return method.bind(target);
|
|
234
|
+
}
|
|
235
|
+
return method;
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Dynamic styler instance for external use
|
|
244
|
+
*/
|
|
245
|
+
export const $ = createStyler();
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Pre-defined style presets for common use cases
|
|
249
|
+
*/
|
|
250
|
+
export const StylePresets = {
|
|
251
|
+
success: () => new StyleBuilder()
|
|
252
|
+
.bg('linear-gradient(135deg, #00b894 0%, #00a085 100%)')
|
|
253
|
+
.color('#ffffff')
|
|
254
|
+
.padding('4px 8px')
|
|
255
|
+
.rounded('4px')
|
|
256
|
+
.bold(),
|
|
257
|
+
|
|
258
|
+
error: () => new StyleBuilder()
|
|
259
|
+
.bg('linear-gradient(135deg, #e84393 0%, #d63031 100%)')
|
|
260
|
+
.color('#ffffff')
|
|
261
|
+
.padding('4px 8px')
|
|
262
|
+
.rounded('4px')
|
|
263
|
+
.bold(),
|
|
264
|
+
|
|
265
|
+
warning: () => new StyleBuilder()
|
|
266
|
+
.bg('linear-gradient(135deg, #fdcb6e 0%, #e17055 100%)')
|
|
267
|
+
.color('#2d3436')
|
|
268
|
+
.padding('4px 8px')
|
|
269
|
+
.rounded('4px')
|
|
270
|
+
.bold(),
|
|
271
|
+
|
|
272
|
+
info: () => new StyleBuilder()
|
|
273
|
+
.bg('linear-gradient(135deg, #74b9ff 0%, #0984e3 100%)')
|
|
274
|
+
.color('#ffffff')
|
|
275
|
+
.padding('4px 8px')
|
|
276
|
+
.rounded('4px')
|
|
277
|
+
.bold(),
|
|
278
|
+
|
|
279
|
+
debug: () => new StyleBuilder()
|
|
280
|
+
.bg('linear-gradient(135deg, #667eea 0%, #764ba2 100%)')
|
|
281
|
+
.color('#ffffff')
|
|
282
|
+
.padding('4px 8px')
|
|
283
|
+
.rounded('4px')
|
|
284
|
+
.bold(),
|
|
285
|
+
|
|
286
|
+
muted: () => new StyleBuilder()
|
|
287
|
+
.color('#6c757d')
|
|
288
|
+
.font('Monaco, Consolas, monospace')
|
|
289
|
+
.size('12px'),
|
|
290
|
+
|
|
291
|
+
accent: () => new StyleBuilder()
|
|
292
|
+
.bg('#f8f9fa')
|
|
293
|
+
.color('#495057')
|
|
294
|
+
.padding('2px 6px')
|
|
295
|
+
.rounded('3px')
|
|
296
|
+
.border('1px solid #dee2e6'),
|
|
297
|
+
|
|
298
|
+
neon: () => new StyleBuilder()
|
|
299
|
+
.bg('linear-gradient(135deg, #0f3460 0%, #e94560 100%)')
|
|
300
|
+
.color('#00ffff')
|
|
301
|
+
.padding('4px 8px')
|
|
302
|
+
.rounded('4px')
|
|
303
|
+
.bold()
|
|
304
|
+
.shadow('0 0 10px rgba(0, 255, 255, 0.5)'),
|
|
305
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Banner configurations for Advanced Logger
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { BannerType, ThemeVariant } from '../types/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Banner variants for different display capabilities
|
|
9
|
+
*/
|
|
10
|
+
export const BANNER_VARIANTS = {
|
|
11
|
+
simple: {
|
|
12
|
+
text: 'š ADVANCED LOGGER v2.0.0 - State-of-the-art Console Styling š',
|
|
13
|
+
style: 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 20px; border-radius: 8px; font-weight: bold; font-size: 14px;'
|
|
14
|
+
},
|
|
15
|
+
ascii: {
|
|
16
|
+
text: `
|
|
17
|
+
___ ____ _ __ ___ _ __ _____ _____ ____ __ ___ _____ _____ _____ ____
|
|
18
|
+
/ _ \\ / __ \\| | / / / _ \\ | \\ | |/ ____| ____| _ \\ | | / _ \\ / ____| ___| _ | _ \\
|
|
19
|
+
/ /_\\ \\ / / _\` | |/ / / /_\\ \\ | \\| | | | |__ | | | | | | / / \\ \\| | __| |_ | |_| | |_) |
|
|
20
|
+
| _ || | (_| | < | _ | | . \` | | | __| | | | | | | | | | | | |_ | _| | /| _ <
|
|
21
|
+
| | | |\\ \\__,_|_|\\_\\ | | | | | |\\ | |___| |____| |_| | | |__\\ \\_/ /| |__| | |___| |\\ \\| |_) |
|
|
22
|
+
\\_| |_/ \\____/ \\_| |_/ |_| \\_|\\_____|______|____/ |_____/\\___/ \\_____|_____|_| \\_|____/
|
|
23
|
+
|
|
24
|
+
Advanced Logger v2.0.0 - Console Excellence`,
|
|
25
|
+
style: 'font-family: "Courier New", Consolas, Monaco, monospace; color: #667eea; font-size: 11px; line-height: 1.2;'
|
|
26
|
+
},
|
|
27
|
+
unicode: {
|
|
28
|
+
text: `
|
|
29
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
30
|
+
ā š ADVANCED LOGGER v2.0.0 ā
|
|
31
|
+
ā State-of-the-art Console Styling ā
|
|
32
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`,
|
|
33
|
+
style: 'font-family: "Courier New", Consolas, Monaco, monospace; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px; border-radius: 8px; font-size: 12px; line-height: 1.3;'
|
|
34
|
+
},
|
|
35
|
+
svg: {
|
|
36
|
+
text: ' ',
|
|
37
|
+
style: `
|
|
38
|
+
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80'><defs><linearGradient id='grad' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:%23667eea'/><stop offset='100%' style='stop-color:%23764ba2'/></linearGradient></defs><rect width='100%' height='100%' fill='url(%23grad)' rx='8'/><text x='200' y='30' text-anchor='middle' fill='white' font-family='monospace' font-size='14' font-weight='bold'>š ADVANCED LOGGER</text><text x='200' y='50' text-anchor='middle' fill='white' font-family='monospace' font-size='12'>State-of-the-art Console Styling</text><text x='200' y='65' text-anchor='middle' fill='white' font-family='monospace' font-size='10'>v2.0.0</text></svg>");
|
|
39
|
+
background-repeat: no-repeat;
|
|
40
|
+
background-size: 400px 80px;
|
|
41
|
+
padding: 40px 200px;
|
|
42
|
+
color: transparent;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
border-radius: 8px;
|
|
45
|
+
`
|
|
46
|
+
},
|
|
47
|
+
animated: {
|
|
48
|
+
text: ' š ADVANCED LOGGER v2.0.0 ',
|
|
49
|
+
style: `
|
|
50
|
+
background: linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2);
|
|
51
|
+
background-size: 400% 400%;
|
|
52
|
+
color: white;
|
|
53
|
+
padding: 15px 25px;
|
|
54
|
+
border-radius: 10px;
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
font-family: monospace;
|
|
58
|
+
animation: gradientShift 3s ease infinite;
|
|
59
|
+
display: inline-block;
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Theme-specific banners for enhanced visual theming
|
|
66
|
+
*/
|
|
67
|
+
export const THEME_BANNERS: Record<ThemeVariant, { simple: string; style: string }> = {
|
|
68
|
+
default: {
|
|
69
|
+
simple: 'š ADVANCED LOGGER v2.0.0 - State-of-the-art Console Styling š',
|
|
70
|
+
style: 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 20px; border-radius: 8px; font-weight: bold;'
|
|
71
|
+
},
|
|
72
|
+
dark: {
|
|
73
|
+
simple: 'š ADVANCED LOGGER v2.0.0 - Dark Mode Console Excellence š',
|
|
74
|
+
style: 'background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%); color: #e2e8f0; padding: 12px 20px; border-radius: 8px; font-weight: bold; border: 1px solid #4a5568;'
|
|
75
|
+
},
|
|
76
|
+
neon: {
|
|
77
|
+
simple: 'ā” ADVANCED LOGGER v2.0.0 - Cyberpunk Console Experience ā”',
|
|
78
|
+
style: 'background: linear-gradient(135deg, #0f3460 0%, #e94560 100%); color: #00ffff; padding: 12px 20px; border-radius: 8px; font-weight: bold; text-shadow: 0 0 10px #00ffff;'
|
|
79
|
+
},
|
|
80
|
+
minimal: {
|
|
81
|
+
simple: 'ADVANCED LOGGER v2.0.0 - Clean Console Styling',
|
|
82
|
+
style: 'background: #f7fafc; color: #2d3748; padding: 8px 16px; border: 1px solid #e2e8f0; border-radius: 4px; font-weight: 500;'
|
|
83
|
+
},
|
|
84
|
+
light: {
|
|
85
|
+
simple: 'āļø ADVANCED LOGGER v2.0.0 - Bright Console Styling āļø',
|
|
86
|
+
style: 'background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); color: #495057; padding: 12px 20px; border-radius: 8px; font-weight: bold; border: 1px solid #dee2e6;'
|
|
87
|
+
},
|
|
88
|
+
cyberpunk: {
|
|
89
|
+
simple: 'š¤ ADVANCED LOGGER v2.0.0 - Neural Console Interface š¤',
|
|
90
|
+
style: 'background: linear-gradient(135deg, #0d1b2a 0%, #415a77 100%); color: #00d4aa; padding: 12px 20px; border-radius: 8px; font-weight: bold; text-shadow: 0 0 10px #00d4aa; border: 1px solid #00d4aa;'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Feature detection for banner capabilities
|
|
96
|
+
*/
|
|
97
|
+
export function detectBannerCapabilities(): BannerType {
|
|
98
|
+
// Try to detect browser capabilities
|
|
99
|
+
const userAgent = navigator.userAgent;
|
|
100
|
+
const isChrome = /Chrome/.test(userAgent);
|
|
101
|
+
const isFirefox = /Firefox/.test(userAgent);
|
|
102
|
+
const isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent);
|
|
103
|
+
|
|
104
|
+
// Check for SVG support (most modern browsers)
|
|
105
|
+
const supportsSVG = !!document.createElementNS &&
|
|
106
|
+
!!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect;
|
|
107
|
+
|
|
108
|
+
// Check for CSS animation support
|
|
109
|
+
const supportsAnimations = typeof document !== 'undefined' &&
|
|
110
|
+
'animationName' in document.createElement('div').style;
|
|
111
|
+
|
|
112
|
+
// Progressive enhancement
|
|
113
|
+
if (supportsAnimations && isChrome) {
|
|
114
|
+
return 'animated';
|
|
115
|
+
} else if (supportsSVG && (isChrome || isFirefox)) {
|
|
116
|
+
return 'svg';
|
|
117
|
+
} else if (isChrome || isFirefox) {
|
|
118
|
+
return 'unicode';
|
|
119
|
+
} else if (isSafari) {
|
|
120
|
+
return 'ascii';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return 'simple';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Display initialization banner with advanced styling
|
|
128
|
+
*/
|
|
129
|
+
export function displayInitBanner(bannerType?: BannerType): void {
|
|
130
|
+
const selectedType = bannerType || detectBannerCapabilities();
|
|
131
|
+
const banner = BANNER_VARIANTS[selectedType];
|
|
132
|
+
|
|
133
|
+
// Add CSS animation keyframes if needed
|
|
134
|
+
if (selectedType === 'animated') {
|
|
135
|
+
const style = document.createElement('style');
|
|
136
|
+
style.textContent = `
|
|
137
|
+
@keyframes gradientShift {
|
|
138
|
+
0% { background-position: 0% 50%; }
|
|
139
|
+
50% { background-position: 100% 50%; }
|
|
140
|
+
100% { background-position: 0% 50%; }
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
document.head.appendChild(style);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log(`%c${banner.text}`, banner.style);
|
|
147
|
+
|
|
148
|
+
// Show feature highlights
|
|
149
|
+
const features = [
|
|
150
|
+
'šØ Advanced CSS Console Styling',
|
|
151
|
+
'š Automatic Stack Trace Parsing',
|
|
152
|
+
'š§ Scoped Loggers & Prefixes',
|
|
153
|
+
'ā” Performance Timers',
|
|
154
|
+
'šÆ Verbosity Filtering',
|
|
155
|
+
'š Extensible Handlers',
|
|
156
|
+
'š± Modern TypeScript Patterns',
|
|
157
|
+
'š¤ Export & Clipboard Support'
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
console.group(`%c⨠Features`, 'background: #f8f9fa; color: #495057; padding: 4px 8px; border-radius: 4px; font-weight: bold;');
|
|
161
|
+
|
|
162
|
+
features.forEach(feature => {
|
|
163
|
+
console.log(`%c${feature}`, 'color: #6c757d; font-size: 13px;');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
console.groupEnd();
|
|
167
|
+
console.log(''); // Add spacing
|
|
168
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Styling system exports for Advanced Logger
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { StyleBuilder, $, StylePresets } from './StyleBuilder.js';
|
|
6
|
+
export { THEME_PRESETS } from './themes.js';
|
|
7
|
+
export {
|
|
8
|
+
BANNER_VARIANTS,
|
|
9
|
+
THEME_BANNERS,
|
|
10
|
+
detectBannerCapabilities,
|
|
11
|
+
displayInitBanner
|
|
12
|
+
} from './banners.js';
|