@vielzeug/logit 1.1.1 → 2.0.0
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/README.md +59 -551
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +2 -170
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -5
- package/dist/logit.cjs +2 -2
- package/dist/logit.cjs.map +1 -1
- package/dist/logit.d.ts +72 -0
- package/dist/logit.d.ts.map +1 -0
- package/dist/logit.js +194 -262
- package/dist/logit.js.map +1 -1
- package/package.json +12 -9
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/logit.js
CHANGED
|
@@ -1,264 +1,196 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
//#region src/logit.ts
|
|
2
|
+
var e = {
|
|
3
|
+
debug: 0,
|
|
4
|
+
error: 5,
|
|
5
|
+
info: 2,
|
|
6
|
+
off: 6,
|
|
7
|
+
success: 3,
|
|
8
|
+
trace: 1,
|
|
9
|
+
warn: 4
|
|
10
|
+
}, t = {
|
|
11
|
+
debug: {
|
|
12
|
+
bg: "#616161",
|
|
13
|
+
border: "#424242",
|
|
14
|
+
color: "#fff",
|
|
15
|
+
icon: "☕",
|
|
16
|
+
symbol: "🅳"
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
bg: "#d32f2f",
|
|
20
|
+
border: "#c62828",
|
|
21
|
+
color: "#fff",
|
|
22
|
+
icon: "✘",
|
|
23
|
+
symbol: "🅴"
|
|
24
|
+
},
|
|
25
|
+
group: {
|
|
26
|
+
bg: "#546e7a",
|
|
27
|
+
border: "#455a64",
|
|
28
|
+
color: "#fff",
|
|
29
|
+
icon: "⚭",
|
|
30
|
+
symbol: "🅶"
|
|
31
|
+
},
|
|
32
|
+
info: {
|
|
33
|
+
bg: "#1976d2",
|
|
34
|
+
border: "#1565c0",
|
|
35
|
+
color: "#fff",
|
|
36
|
+
icon: "ℹ",
|
|
37
|
+
symbol: "🅸"
|
|
38
|
+
},
|
|
39
|
+
ns: typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? {
|
|
40
|
+
bg: "#fafafa",
|
|
41
|
+
border: "#c7c7c7",
|
|
42
|
+
color: "#000"
|
|
43
|
+
} : {
|
|
44
|
+
bg: "#424242",
|
|
45
|
+
border: "#212121",
|
|
46
|
+
color: "#fff"
|
|
47
|
+
},
|
|
48
|
+
success: {
|
|
49
|
+
bg: "#689f38",
|
|
50
|
+
border: "#558b2f",
|
|
51
|
+
color: "#fff",
|
|
52
|
+
icon: "✔",
|
|
53
|
+
symbol: "🆂"
|
|
54
|
+
},
|
|
55
|
+
trace: {
|
|
56
|
+
bg: "#d81b60",
|
|
57
|
+
border: "#c2185b",
|
|
58
|
+
color: "#fff",
|
|
59
|
+
icon: "⛢",
|
|
60
|
+
symbol: "🆃"
|
|
61
|
+
},
|
|
62
|
+
warn: {
|
|
63
|
+
bg: "#ffb300",
|
|
64
|
+
border: "#ffa000",
|
|
65
|
+
color: "#fff",
|
|
66
|
+
icon: "⚠",
|
|
67
|
+
symbol: "🆆"
|
|
68
|
+
}
|
|
69
|
+
}, n = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;", r = typeof window > "u", i = r ? process.env.NODE_ENV === "production" : !1, a = i ? "🅿" : "🅳", o = {
|
|
70
|
+
debug: "log",
|
|
71
|
+
error: "error",
|
|
72
|
+
info: "info",
|
|
73
|
+
success: "log",
|
|
74
|
+
trace: "trace",
|
|
75
|
+
warn: "warn"
|
|
54
76
|
};
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
77
|
+
function s(c = {}) {
|
|
78
|
+
let l = typeof c == "string" ? { namespace: c } : c, u = {
|
|
79
|
+
environment: !0,
|
|
80
|
+
logLevel: "debug",
|
|
81
|
+
namespace: "",
|
|
82
|
+
timestamp: !0,
|
|
83
|
+
variant: "symbol",
|
|
84
|
+
...l,
|
|
85
|
+
remote: {
|
|
86
|
+
logLevel: "debug",
|
|
87
|
+
...l.remote
|
|
88
|
+
}
|
|
89
|
+
}, d = (t) => e[u.logLevel] <= e[t], f = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), p = (e) => {
|
|
90
|
+
let n = t[e];
|
|
91
|
+
return u.variant === "text" || !n[u.variant] ? e.toUpperCase() : n[u.variant];
|
|
92
|
+
}, m = (e, n = "") => {
|
|
93
|
+
let { bg: r, border: i, color: a } = t[e], o = `border: 1px solid ${i}; border-radius: 4px`;
|
|
94
|
+
switch (u.variant) {
|
|
95
|
+
case "icon": return `color: ${r}; ${o}; padding: 0 3px${n}`;
|
|
96
|
+
case "symbol": return `color: ${r}; ${o}; padding: 0 1px${n}`;
|
|
97
|
+
default: return `background: ${r}; color: ${a}; ${o}; font-weight: bold; padding: 0 3px${n}`;
|
|
98
|
+
}
|
|
99
|
+
}, h = (e, t, n, r) => {
|
|
100
|
+
let i = [p(e)];
|
|
101
|
+
u.environment && i.push(a), t && i.push(`[${t}]`), n && i.push(n);
|
|
102
|
+
let s = console[o[e]];
|
|
103
|
+
s(`${i.join(" | ")} |`, ...r);
|
|
104
|
+
}, g = (e, t, r, i) => {
|
|
105
|
+
let s = `%c${p(e)}%c`, c = [m(e), ""];
|
|
106
|
+
t && (s += ` %c${t}%c`, c.push(m("ns", `; ${n}`), "")), u.environment && (s += ` %c${a}%c`, c.push("color: darkgray", "")), r && (s += ` %c${r}%c`, c.push("color: gray", ""));
|
|
107
|
+
let l = console[o[e]];
|
|
108
|
+
l(s, ...c, ...i);
|
|
109
|
+
}, _ = (t, n) => {
|
|
110
|
+
if (!d(t)) return;
|
|
111
|
+
let a = u.namespace, o = u.timestamp ? f() : "";
|
|
112
|
+
r ? h(t, a, o, n) : g(t, a, o, n);
|
|
113
|
+
let { handler: s, logLevel: c } = u.remote;
|
|
114
|
+
if (s && e[c] <= e[t]) {
|
|
115
|
+
let e = {
|
|
116
|
+
args: n,
|
|
117
|
+
env: i ? "production" : "development",
|
|
118
|
+
namespace: a || void 0,
|
|
119
|
+
timestamp: u.timestamp ? (/* @__PURE__ */ new Date()).toISOString() : void 0
|
|
120
|
+
};
|
|
121
|
+
Promise.resolve().then(() => s(t, e)).catch(() => {});
|
|
122
|
+
}
|
|
123
|
+
}, v = (e) => u.namespace ? `[${u.namespace}] ${e}` : e, y = (e = {}) => {
|
|
124
|
+
let { remote: t, ...n } = e;
|
|
125
|
+
return s({
|
|
126
|
+
...u,
|
|
127
|
+
...n,
|
|
128
|
+
remote: {
|
|
129
|
+
...u.remote,
|
|
130
|
+
...t
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}, b = (e, t, n, r) => {
|
|
134
|
+
let i = e ? console.groupCollapsed : console.group, o = [p("group")];
|
|
135
|
+
u.environment && o.push(a), o.push(t), n && o.push(`[${n}]`), r && o.push(r), i(o.join(" | "));
|
|
136
|
+
}, x = (e, t, r, i) => {
|
|
137
|
+
let o = e ? console.groupCollapsed : console.group, s = `%c${t}%c`, c = [m("group", "; margin-right: 6px; padding: 1px 3px 0"), ""];
|
|
138
|
+
r && (s += ` %c${r}%c`, c.push(m("ns", `; ${n}; margin-right: 6px`), "")), u.environment && (s += ` %c${a}%c`, c.push("color: darkgray; margin-right: 6px", "")), i && (s += ` %c${i}%c`, c.push("color: gray; font-weight: lighter; margin-right: 6px", "")), o(s, ...c);
|
|
139
|
+
}, S = (e, t) => {
|
|
140
|
+
let n = u.namespace, i = u.timestamp ? f() : "";
|
|
141
|
+
r ? b(e, t, n, i) : x(e, t, n, i);
|
|
142
|
+
}, C = {
|
|
143
|
+
assert: (e, ...t) => {
|
|
144
|
+
d("error") && console.assert(e, ...t);
|
|
145
|
+
},
|
|
146
|
+
child: y,
|
|
147
|
+
get config() {
|
|
148
|
+
return {
|
|
149
|
+
...u,
|
|
150
|
+
remote: { ...u.remote }
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
debug: (...e) => _("debug", e),
|
|
154
|
+
enabled: (e) => d(e),
|
|
155
|
+
error: (...e) => _("error", e),
|
|
156
|
+
group: (e, t, n = !1) => {
|
|
157
|
+
if (!d("debug")) return t();
|
|
158
|
+
S(n, e);
|
|
159
|
+
try {
|
|
160
|
+
let e = t();
|
|
161
|
+
return e instanceof Promise ? e.finally(() => console.groupEnd()) : (console.groupEnd(), e);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
throw console.groupEnd(), e;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
info: (...e) => _("info", e),
|
|
167
|
+
scope: (e) => y({ namespace: u.namespace ? `${u.namespace}.${e}` : e }),
|
|
168
|
+
setConfig: (e) => {
|
|
169
|
+
let { remote: t, ...n } = e;
|
|
170
|
+
return t !== void 0 && Object.assign(u.remote, t), Object.assign(u, n), C;
|
|
171
|
+
},
|
|
172
|
+
success: (...e) => _("success", e),
|
|
173
|
+
table: (e, t) => {
|
|
174
|
+
d("debug") && console.table(e, t);
|
|
175
|
+
},
|
|
176
|
+
time: (e, t) => {
|
|
177
|
+
if (!d("debug")) return t();
|
|
178
|
+
let n = v(e);
|
|
179
|
+
console.time(n);
|
|
180
|
+
try {
|
|
181
|
+
let e = t();
|
|
182
|
+
return e instanceof Promise ? e.finally(() => console.timeEnd(n)) : (console.timeEnd(n), e);
|
|
183
|
+
} catch (e) {
|
|
184
|
+
throw console.timeEnd(n), e;
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
trace: (...e) => _("trace", e),
|
|
188
|
+
warn: (...e) => _("warn", e)
|
|
189
|
+
};
|
|
190
|
+
return C;
|
|
60
191
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (!i(e)) return;
|
|
68
|
-
const { format: r, parts: s } = D(e), t = console[f(e)];
|
|
69
|
-
t(r, ...s, ...n), _(e, n);
|
|
70
|
-
}, N = (e) => {
|
|
71
|
-
const n = Math.floor(Date.now() - e);
|
|
72
|
-
return n ? `${n}ms` : "";
|
|
73
|
-
}, O = {
|
|
74
|
-
/**
|
|
75
|
-
* Asserts a condition and logs an error if it's false.
|
|
76
|
-
*/
|
|
77
|
-
assert: (e, n, r) => console.assert(e, n, r),
|
|
78
|
-
debug: (...e) => a("debug", ...e),
|
|
79
|
-
error: (...e) => a("error", ...e),
|
|
80
|
-
/**
|
|
81
|
-
* Gets whether the environment indicator is shown.
|
|
82
|
-
*/
|
|
83
|
-
getEnvironment: () => o.environment,
|
|
84
|
-
/**
|
|
85
|
-
* Gets the current log level.
|
|
86
|
-
*/
|
|
87
|
-
getLevel: () => o.logLevel,
|
|
88
|
-
/**
|
|
89
|
-
* Gets the current namespace prefix.
|
|
90
|
-
*/
|
|
91
|
-
getPrefix: () => o.namespace,
|
|
92
|
-
/**
|
|
93
|
-
* Gets whether timestamps are shown.
|
|
94
|
-
*/
|
|
95
|
-
getTimestamp: () => o.timestamp,
|
|
96
|
-
/**
|
|
97
|
-
* Gets the current display variant.
|
|
98
|
-
*/
|
|
99
|
-
getVariant: () => o.variant,
|
|
100
|
-
/**
|
|
101
|
-
* Creates a collapsed group in the console.
|
|
102
|
-
*/
|
|
103
|
-
groupCollapsed: (e, n = "GROUP", r = Date.now()) => {
|
|
104
|
-
if (!i("success")) return;
|
|
105
|
-
const s = N(r), t = d(), c = o.timestamp ? p() : "";
|
|
106
|
-
console.groupCollapsed(
|
|
107
|
-
`%c${n}%c${o.namespace}%c${t}%c${c}%c${s}%c${e}`,
|
|
108
|
-
l("group", "; margin-right: 6px; padding: 1px 3px 0"),
|
|
109
|
-
l("ns", `; ${b}; margin-right: 6px`),
|
|
110
|
-
"color: darkgray; margin-right: 6px",
|
|
111
|
-
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
112
|
-
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
113
|
-
"color: inherit; font-weight: lighter"
|
|
114
|
-
);
|
|
115
|
-
},
|
|
116
|
-
/**
|
|
117
|
-
* Ends the current console group.
|
|
118
|
-
*/
|
|
119
|
-
groupEnd: () => {
|
|
120
|
-
i("success") && console.groupEnd();
|
|
121
|
-
},
|
|
122
|
-
info: (...e) => a("info", ...e),
|
|
123
|
-
/**
|
|
124
|
-
* Creates a scoped logger with a namespaced prefix.
|
|
125
|
-
* Does not mutate global state - returns an isolated logger instance.
|
|
126
|
-
*
|
|
127
|
-
* @param namespace - The namespace to prepend to all log messages
|
|
128
|
-
* @returns A scoped logger with all logging methods
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* const apiLogger = Logit.scope('api');
|
|
133
|
-
* apiLogger.info('Request received'); // [API] Request received
|
|
134
|
-
*
|
|
135
|
-
* const dbLogger = Logit.scope('database');
|
|
136
|
-
* dbLogger.error('Connection failed'); // [DATABASE] Connection failed
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
scope: (e) => {
|
|
140
|
-
const n = o.namespace, r = n ? `${n}.${e}` : e;
|
|
141
|
-
return {
|
|
142
|
-
debug: (...s) => {
|
|
143
|
-
const t = o.namespace;
|
|
144
|
-
o.namespace = r, a("debug", ...s), o.namespace = t;
|
|
145
|
-
},
|
|
146
|
-
error: (...s) => {
|
|
147
|
-
const t = o.namespace;
|
|
148
|
-
o.namespace = r, a("error", ...s), o.namespace = t;
|
|
149
|
-
},
|
|
150
|
-
info: (...s) => {
|
|
151
|
-
const t = o.namespace;
|
|
152
|
-
o.namespace = r, a("info", ...s), o.namespace = t;
|
|
153
|
-
},
|
|
154
|
-
success: (...s) => {
|
|
155
|
-
const t = o.namespace;
|
|
156
|
-
o.namespace = r, a("success", ...s), o.namespace = t;
|
|
157
|
-
},
|
|
158
|
-
trace: (...s) => {
|
|
159
|
-
const t = o.namespace;
|
|
160
|
-
o.namespace = r, a("trace", ...s), o.namespace = t;
|
|
161
|
-
},
|
|
162
|
-
warn: (...s) => {
|
|
163
|
-
const t = o.namespace;
|
|
164
|
-
o.namespace = r, a("warn", ...s), o.namespace = t;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
/**
|
|
169
|
-
* Sets the minimum log level to display.
|
|
170
|
-
*/
|
|
171
|
-
setLogLevel: (e) => {
|
|
172
|
-
o.logLevel = e;
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Sets the namespace prefix for all logs.
|
|
176
|
-
*/
|
|
177
|
-
setPrefix: (e) => {
|
|
178
|
-
o.namespace = e;
|
|
179
|
-
},
|
|
180
|
-
/**
|
|
181
|
-
* Configures remote logging options.
|
|
182
|
-
*/
|
|
183
|
-
setRemote: (e) => {
|
|
184
|
-
o.remote = e;
|
|
185
|
-
},
|
|
186
|
-
/**
|
|
187
|
-
* Sets the log level for remote logging.
|
|
188
|
-
*/
|
|
189
|
-
setRemoteLogLevel: (e) => {
|
|
190
|
-
o.remote.logLevel = e;
|
|
191
|
-
},
|
|
192
|
-
/**
|
|
193
|
-
* Configures Logit with custom options.
|
|
194
|
-
*
|
|
195
|
-
* Note: The remote option will be merged with existing remote config,
|
|
196
|
-
* not replaced entirely. To clear a remote handler, set remote.handler to undefined.
|
|
197
|
-
*/
|
|
198
|
-
setup: (e) => {
|
|
199
|
-
e.remote && (o.remote = { ...o.remote, ...e.remote }, delete e.remote), Object.assign(o, e);
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* Sets the display variant (text, icon, or symbol).
|
|
203
|
-
*/
|
|
204
|
-
setVariant: (e) => {
|
|
205
|
-
o.variant = e;
|
|
206
|
-
},
|
|
207
|
-
success: (...e) => a("success", ...e),
|
|
208
|
-
/**
|
|
209
|
-
* Displays data in a table format.
|
|
210
|
-
*/
|
|
211
|
-
table: (...e) => {
|
|
212
|
-
i("table") && console.table(...e);
|
|
213
|
-
},
|
|
214
|
-
/**
|
|
215
|
-
* Starts a timer with the given label.
|
|
216
|
-
*/
|
|
217
|
-
time: (e) => {
|
|
218
|
-
i("time") && console.time(e);
|
|
219
|
-
},
|
|
220
|
-
/**
|
|
221
|
-
* Ends a timer with the given label.
|
|
222
|
-
*/
|
|
223
|
-
timeEnd: (e) => {
|
|
224
|
-
i("time") && console.timeEnd(e);
|
|
225
|
-
},
|
|
226
|
-
/**
|
|
227
|
-
* Toggles or sets the environment indicator visibility.
|
|
228
|
-
* When called without arguments, toggles the current state.
|
|
229
|
-
*
|
|
230
|
-
* @param value - Optional boolean to explicitly set the state
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```ts
|
|
234
|
-
* Logit.toggleEnvironment(); // Toggles current state
|
|
235
|
-
* Logit.toggleEnvironment(true); // Shows environment indicator
|
|
236
|
-
* Logit.toggleEnvironment(false); // Hides environment indicator
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
toggleEnvironment: (e) => {
|
|
240
|
-
o.environment = e ?? !o.environment;
|
|
241
|
-
},
|
|
242
|
-
/**
|
|
243
|
-
* Toggles or sets timestamp visibility in logs.
|
|
244
|
-
* When called without arguments, toggles the current state.
|
|
245
|
-
*
|
|
246
|
-
* @param value - Optional boolean to explicitly set the state
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```ts
|
|
250
|
-
* Logit.toggleTimestamp(); // Toggles current state
|
|
251
|
-
* Logit.toggleTimestamp(true); // Shows timestamps
|
|
252
|
-
* Logit.toggleTimestamp(false); // Hides timestamps
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
toggleTimestamp: (e) => {
|
|
256
|
-
o.timestamp = e ?? !o.timestamp;
|
|
257
|
-
},
|
|
258
|
-
trace: (...e) => a("trace", ...e),
|
|
259
|
-
warn: (...e) => a("warn", ...e)
|
|
260
|
-
};
|
|
261
|
-
export {
|
|
262
|
-
O as Logit
|
|
263
|
-
};
|
|
264
|
-
//# sourceMappingURL=logit.js.map
|
|
192
|
+
var c = s();
|
|
193
|
+
//#endregion
|
|
194
|
+
export { c as Logit, s as createLogger };
|
|
195
|
+
|
|
196
|
+
//# sourceMappingURL=logit.js.map
|
package/dist/logit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logit.js","sources":["../src/logit.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noAssignInExpressions: - */\n/** biome-ignore-all lint/suspicious/noExplicitAny: - */\n\n/**\n * Environment indicator symbols.\n */\nconst ENV_PROD = '\\uD83C\\uDD3F'; // 🅿\nconst ENV_DEV = '\\uD83C\\uDD33'; // 🅳\n\n/**\n * Console method mappings for log types.\n */\nconst CONSOLE_METHOD_MAP: Record<string, keyof Console> = {\n debug: 'log',\n success: 'log',\n} as const;\n\n/**\n * Checks if the current environment is production.\n * Cached for performance - evaluated once at a module load.\n *\n * Note: import.meta.env is available in Vite/Bundlers but may be undefined in some environments.\n * Using 'any' cast is necessary for cross-environment compatibility.\n */\nconst isProduction = (): boolean => {\n // Browser environment (Vite, Webpack, etc.)\n // import.meta.env may be undefined in some bundlers - safe check with optional chaining\n if (typeof window !== 'undefined' && (import.meta as any)?.env?.NODE_ENV) {\n return (import.meta as any).env.NODE_ENV === 'production';\n }\n\n // Node.js environment\n // @ts-expect-error - process.env exists in Node.js but not in browser\n if (typeof process !== 'undefined' && (process as any).env?.NODE_ENV) {\n // @ts-expect-error - process.env exists in Node.js\n return (process as any).env.NODE_ENV === 'production';\n }\n\n return false;\n};\n\n// Cache the result to avoid repeated checks\nconst IS_PROD = isProduction();\n\nexport type LogitInstance = typeof Logit;\nexport type LogitType = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error';\nexport type LogitColors = Exclude<LogitType, 'table'> | 'group' | 'ns';\nexport type LogitLevel = LogitType | 'off';\nexport type LogitRemoteOptions = {\n handler?: (...args: any[]) => void;\n logLevel: LogitLevel;\n};\nexport type LogitOptions = {\n environment?: boolean;\n variant?: 'text' | 'symbol' | 'icon';\n logLevel?: LogitLevel;\n namespace?: string;\n remote?: LogitRemoteOptions;\n timestamp?: boolean;\n};\nexport type LogitTheme = { color: string; bg: string; border: string; icon?: string; symbol?: string };\n\n/**\n * Scoped logger interface with namespaced logging methods.\n */\nexport type ScopedLogger = {\n debug: (...args: any[]) => void;\n error: (...args: any[]) => void;\n info: (...args: any[]) => void;\n success: (...args: any[]) => void;\n trace: (...args: any[]) => void;\n warn: (...args: any[]) => void;\n};\n\n/**\n * Detects dark mode preference at module load time.\n * Note: This is intentionally static and won't update if the user changes their theme.\n */\nconst isDark = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst Theme: Readonly<Record<LogitColors, LogitTheme>> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '\\u2615', symbol: '\\uD83C\\uDD73' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '\\u2718', symbol: '\\uD83C\\uDD74' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '\\u26AD', symbol: '\\uD83C\\uDD76' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: '\\u2139', symbol: '\\uD83C\\uDD78' },\n ns: isDark\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '\\u2714', symbol: '\\uD83C\\uDD82' },\n time: { bg: '#0097a7', border: '#00838f', color: '#fff', icon: '\\u23F2', symbol: '\\uD83C\\uDD83' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '\\u26e2', symbol: '\\uD83C\\uDD83' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '\\u26a0', symbol: '\\uD83C\\uDD86' },\n};\n\n// biome-ignore assist/source/useSortedKeys: -\nconst logLevel: Readonly<Record<LogitLevel, number>> = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8,\n};\n\nconst state: Required<LogitOptions> = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n remote: { handler: undefined, logLevel: 'off' },\n timestamp: true,\n variant: 'symbol',\n};\n\n/**\n * Determines if a log message should be shown based on the current log level.\n */\nconst shouldLog = (type: LogitType): boolean => logLevel[state.logLevel] <= logLevel[type];\n\n/**\n * Gets the current timestamp in ISO format (HH:MM:SS.mmm).\n */\nconst getCurrentTimestamp = (): string => new Date().toISOString().slice(11, 23);\n\n/**\n * Gets the environment indicator symbol.\n */\nconst getEnvIndicator = (): string => (IS_PROD ? ENV_PROD : ENV_DEV);\n\n/**\n * Sends log data to a remote handler if configured.\n */\nconst sendRemoteLog = (type: LogitType, args: any[]): void => {\n if (state.remote.handler && logLevel[state.remote.logLevel] <= logLevel[type]) {\n Promise.resolve().then(() => {\n state.remote.handler?.(type, {\n args,\n environment: IS_PROD ? 'production' : 'development',\n namespace: state.namespace || undefined,\n timestamp: state.timestamp ? getCurrentTimestamp() : undefined,\n });\n });\n }\n};\n\n/**\n * Gets the console method for a given log type.\n */\nconst getConsoleMethod = (type: LogitType): keyof Console => {\n return (CONSOLE_METHOD_MAP[type] || type) as keyof Console;\n};\n\n/**\n * CSS style constants for consistent formatting.\n */\nconst BASE_BORDER_STYLE = 'border: 1px solid';\nconst BASE_BORDER_RADIUS = 'border-radius: 4px';\nconst NAMESPACE_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/**\n * Generates CSS styles for log messages based on theme and variant.\n *\n * @param type - Log type color scheme\n * @param extra - Additional CSS to append (should include leading semicolon if needed)\n */\nconst style = (type: LogitColors, extra = ''): string => {\n const { bg, color, border } = Theme[type];\n const baseStyle = `${BASE_BORDER_STYLE} ${border}; ${BASE_BORDER_RADIUS}`;\n\n switch (state.variant) {\n case 'symbol':\n // Symbol variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 1px 1px 0${extra}`;\n case 'icon':\n // Icon variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 0 3px${extra}`;\n default:\n // Text variant: white text on a colored background\n return `background: ${bg}; color: ${color}; ${baseStyle}; font-weight: bold; padding: 0 3px${extra}`;\n }\n};\n\n/**\n * Gets the display value for a log type based on the current variant.\n */\nconst getDisplayValue = (type: LogitType): string => {\n const theme = Theme[type as LogitColors];\n const { variant } = state;\n\n // For 'text' variant or if the variant property doesn't exist in theme, use uppercase type\n if (variant === 'text' || !theme || !theme[variant]) {\n return type.toUpperCase();\n }\n\n return theme[variant] as string;\n};\n\n/**\n * Builds the format string and style parts for browser console logging.\n */\nfunction buildBrowserLogParts(type: LogitType): { format: string; parts: string[] } {\n const { namespace, timestamp, environment } = state;\n\n let format = `%c${getDisplayValue(type)}%c`;\n const parts: string[] = [style(type as LogitColors), ''];\n\n if (namespace) {\n format += ` %c${namespace}%c`;\n parts.push(style('ns', `; ${NAMESPACE_STYLE}`), '');\n }\n\n if (environment) {\n format += ` %c${getEnvIndicator()}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (timestamp) {\n format += ` %c${getCurrentTimestamp()}%c`;\n parts.push('color: gray', '');\n }\n\n return { format, parts };\n}\n\n/**\n * Logs messages to the console with styling and metadata.\n */\nconst log = (type: LogitType, ...args: any[]): void => {\n // Server-side logging (Node.js)\n if (typeof window === 'undefined') {\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n consoleMethod(`${getDisplayValue(type)} | ${getEnvIndicator()} |`, ...args);\n return;\n }\n\n // Check the log level\n if (!shouldLog(type)) return;\n\n // Browser-side logging with styling\n const { format, parts } = buildBrowserLogParts(type);\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n\n consoleMethod(format, ...parts, ...args);\n sendRemoteLog(type, args);\n};\n\n/**\n * Formats the elapsed time for display.\n */\nconst formatElapsedTime = (startTime: number): string => {\n const elapsed = Math.floor(Date.now() - startTime);\n return elapsed ? `${elapsed}ms` : '';\n};\n\nexport const Logit = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (valid: boolean, message: string, context: Record<string, any>): void =>\n console.assert(valid, message, context),\n\n debug: (...args: any[]): void => log('debug', ...args),\n error: (...args: any[]): void => log('error', ...args),\n\n /**\n * Gets whether the environment indicator is shown.\n */\n getEnvironment: (): boolean => state.environment,\n\n /**\n * Gets the current log level.\n */\n getLevel: (): LogitLevel => state.logLevel,\n\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: (): string => state.namespace,\n\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: (): boolean => state.timestamp,\n\n /**\n * Gets the current display variant.\n */\n getVariant: (): 'text' | 'symbol' | 'icon' => state.variant,\n\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (text: string, label = 'GROUP', time = Date.now()): void => {\n if (!shouldLog('success')) return;\n\n const elapsed = formatElapsedTime(time);\n const env = getEnvIndicator();\n const timestamp = state.timestamp ? getCurrentTimestamp() : '';\n\n console.groupCollapsed(\n `%c${label}%c${state.namespace}%c${env}%c${timestamp}%c${elapsed}%c${text}`,\n style('group', '; margin-right: 6px; padding: 1px 3px 0'),\n style('ns', `; ${NAMESPACE_STYLE}; margin-right: 6px`),\n 'color: darkgray; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: inherit; font-weight: lighter',\n );\n },\n\n /**\n * Ends the current console group.\n */\n groupEnd: (): void => {\n if (shouldLog('success')) console.groupEnd();\n },\n\n info: (...args: any[]): void => log('info', ...args),\n\n /**\n * Creates a scoped logger with a namespaced prefix.\n * Does not mutate global state - returns an isolated logger instance.\n *\n * @param namespace - The namespace to prepend to all log messages\n * @returns A scoped logger with all logging methods\n *\n * @example\n * ```ts\n * const apiLogger = Logit.scope('api');\n * apiLogger.info('Request received'); // [API] Request received\n *\n * const dbLogger = Logit.scope('database');\n * dbLogger.error('Connection failed'); // [DATABASE] Connection failed\n * ```\n */\n scope: (namespace: string): ScopedLogger => {\n const originalNamespace = state.namespace;\n const scopedNamespace = originalNamespace ? `${originalNamespace}.${namespace}` : namespace;\n\n return {\n debug: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('debug', ...args);\n state.namespace = prev;\n },\n error: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('error', ...args);\n state.namespace = prev;\n },\n info: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('info', ...args);\n state.namespace = prev;\n },\n success: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('success', ...args);\n state.namespace = prev;\n },\n trace: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('trace', ...args);\n state.namespace = prev;\n },\n warn: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('warn', ...args);\n state.namespace = prev;\n },\n };\n },\n\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (level: LogitLevel): void => {\n state.logLevel = level;\n },\n\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (namespace: string): void => {\n state.namespace = namespace;\n },\n\n /**\n * Configures remote logging options.\n */\n setRemote: (remote: LogitRemoteOptions): void => {\n state.remote = remote;\n },\n\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (level: LogitLevel): void => {\n state.remote.logLevel = level;\n },\n\n /**\n * Configures Logit with custom options.\n *\n * Note: The remote option will be merged with existing remote config,\n * not replaced entirely. To clear a remote handler, set remote.handler to undefined.\n */\n setup: (options: LogitOptions): void => {\n if (options.remote) {\n state.remote = { ...state.remote, ...options.remote };\n delete (options as any).remote; // Remove to avoid Object.assign overwrite\n }\n Object.assign(state, options);\n },\n\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (variant: 'text' | 'icon' | 'symbol'): void => {\n state.variant = variant;\n },\n\n success: (...args: any[]): void => log('success', ...args),\n\n /**\n * Displays data in a table format.\n */\n table: (...args: any[]): void => {\n if (shouldLog('table')) console.table(...args);\n },\n\n /**\n * Starts a timer with the given label.\n */\n time: (label: string): void => {\n if (shouldLog('time')) console.time(label);\n },\n\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (label: string): void => {\n if (shouldLog('time')) console.timeEnd(label);\n },\n\n /**\n * Toggles or sets the environment indicator visibility.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleEnvironment(); // Toggles current state\n * Logit.toggleEnvironment(true); // Shows environment indicator\n * Logit.toggleEnvironment(false); // Hides environment indicator\n * ```\n */\n toggleEnvironment: (value?: boolean): void => {\n state.environment = value ?? !state.environment;\n },\n\n /**\n * Toggles or sets timestamp visibility in logs.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleTimestamp(); // Toggles current state\n * Logit.toggleTimestamp(true); // Shows timestamps\n * Logit.toggleTimestamp(false); // Hides timestamps\n * ```\n */\n toggleTimestamp: (value?: boolean): void => {\n state.timestamp = value ?? !state.timestamp;\n },\n\n trace: (...args: any[]): void => log('trace', ...args),\n warn: (...args: any[]): void => log('warn', ...args),\n};\n"],"names":["CONSOLE_METHOD_MAP","isProduction","__vite_import_meta_env__","IS_PROD","isDark","Theme","logLevel","state","shouldLog","type","getCurrentTimestamp","getEnvIndicator","sendRemoteLog","args","getConsoleMethod","BASE_BORDER_STYLE","BASE_BORDER_RADIUS","NAMESPACE_STYLE","style","extra","bg","color","border","baseStyle","getDisplayValue","theme","variant","buildBrowserLogParts","namespace","timestamp","environment","format","parts","log","consoleMethod","formatElapsedTime","startTime","elapsed","Logit","valid","message","context","text","label","time","env","originalNamespace","scopedNamespace","prev","level","remote","options","value"],"mappings":";AAYA,MAAMA,IAAoD;AAAA,EACxD,OAAO;AAAA,EACP,SAAS;AACX,GASMC,IAAe,MAGf,OAAO,SAAW,OAAgBC,GAA0B,WACtD,KAKN,OAAO,UAAY,OAAgB,QAAgB,KAAK,WAElD,QAAgB,IAAI,aAAa,eAGpC,IAIHC,IAAUF,EAAA,GAoCVG,IAAS,OAAO,SAAW,OAAe,OAAO,aAAa,8BAA8B,EAAE,SAE9FC,IAAmD;AAAA,EACvD,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAU,QAAQ,KAAA;AAAA,EAClF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAU,QAAQ,KAAA;AAAA,EAClF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAU,QAAQ,KAAA;AAAA,EAClF,MAAM,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAU,QAAQ,KAAA;AAAA,EACjF,IAAID,IACA,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAA,IAC3C,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAA;AAAA,EAC/C,SAAS,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,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AAQ,MAAM,GAAGK,CAAI;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,CAAC8B,MAAwB;AAC7B,IAAInC,EAAU,MAAM,KAAG,QAAQ,KAAKmC,CAAK;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS,CAACA,MAAwB;AAChC,IAAInC,EAAU,MAAM,KAAG,QAAQ,QAAQmC,CAAK;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,mBAAmB,CAACS,MAA0B;AAC5C,IAAA7C,EAAM,cAAc6C,KAAS,CAAC7C,EAAM;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,iBAAiB,CAAC6C,MAA0B;AAC1C,IAAA7C,EAAM,YAAY6C,KAAS,CAAC7C,EAAM;AAAA,EACpC;AAAA,EAEA,OAAO,IAAIM,MAAsBoB,EAAI,SAAS,GAAGpB,CAAI;AAAA,EACrD,MAAM,IAAIA,MAAsBoB,EAAI,QAAQ,GAAGpB,CAAI;AACrD;"}
|
|
1
|
+
{"version":3,"file":"logit.js","names":[],"sources":["../src/logit.ts"],"sourcesContent":["/* -------------------- Types -------------------- */\n\nexport type LogType = 'debug' | 'trace' | 'info' | 'success' | 'warn' | 'error';\nexport type LogLevel = LogType | 'off';\nexport type Variant = 'text' | 'symbol' | 'icon';\n\nexport type RemoteHandler = (type: LogType, data: RemoteLogData) => void;\n\nexport type RemoteOptions = { handler?: RemoteHandler; logLevel?: LogLevel };\n\nexport type RemoteLogData = {\n args: unknown[];\n env: 'production' | 'development';\n namespace?: string;\n timestamp?: string;\n};\n\nexport type LogitOptions = {\n environment?: boolean;\n logLevel?: LogLevel;\n namespace?: string;\n remote?: RemoteOptions;\n timestamp?: boolean;\n variant?: Variant;\n};\n\n/** The shape of a fully resolved logger config (all fields present). */\ntype ResolvedRemote = { handler?: RemoteHandler; logLevel: LogLevel };\nexport type LogitConfig = Omit<Required<LogitOptions>, 'remote'> & { remote: ResolvedRemote };\n\nexport type Logger = {\n assert: (condition: boolean, ...args: unknown[]) => void;\n child: (overrides?: LogitOptions) => Logger;\n readonly config: Readonly<LogitConfig>;\n debug: (...args: unknown[]) => void;\n enabled: (type: LogLevel) => boolean;\n error: (...args: unknown[]) => void;\n group: <T>(label: string, fn: () => T, collapsed?: boolean) => T;\n info: (...args: unknown[]) => void;\n scope: (name: string) => Logger;\n setConfig: (opts: LogitOptions) => Logger;\n success: (...args: unknown[]) => void;\n table: (data: unknown, properties?: string[]) => void;\n time: <T>(label: string, fn: () => T) => T;\n trace: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n};\n\n/* -------------------- Priority -------------------- */\n\nconst PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n error: 5,\n info: 2,\n off: 6,\n success: 3,\n trace: 1,\n warn: 4,\n};\n\n/* -------------------- Theme -------------------- */\n\ntype Theme = { bg: string; border: string; color: string; icon?: string; symbol?: string };\n\nconst isDarkMode = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst THEME: Record<LogType | 'group' | 'ns', Theme> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '☕', symbol: '🅳' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '✘', symbol: '🅴' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '⚭', symbol: '🅶' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: 'ℹ', symbol: '🅸' },\n ns: isDarkMode\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '✔', symbol: '🆂' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '⛢', symbol: '🆃' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '⚠', symbol: '🆆' },\n};\n\nconst NS_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/* -------------------- createLogger -------------------- */\n\nconst IS_NODE = typeof window === 'undefined';\nconst IS_PROD = IS_NODE\n ? // @ts-expect-error - process is Node-only\n (process as any).env?.NODE_ENV === 'production'\n : (import.meta as any)?.env?.NODE_ENV === 'production';\n\nconst ENV_BADGE = IS_PROD ? '🅿' : '🅳';\n\nconst LOG_METHOD: Record<LogType, 'log' | 'info' | 'warn' | 'error' | 'trace'> = {\n debug: 'log',\n error: 'error',\n info: 'info',\n success: 'log',\n trace: 'trace',\n warn: 'warn',\n};\n\n/**\n * Creates an independent logger instance with its own isolated configuration.\n *\n * @example\n * ```ts\n * const log = createLogger({ logLevel: 'info', namespace: 'App' });\n * log.info('Hello');\n *\n * const apiLog = log.scope('api');\n * apiLog.warn('slow request');\n * ```\n */\nexport function createLogger(initial: LogitOptions | string = {}): Logger {\n const opts: LogitOptions = typeof initial === 'string' ? { namespace: initial } : initial;\n const cfg: LogitConfig = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n timestamp: true,\n variant: 'symbol',\n ...opts,\n remote: { logLevel: 'debug', ...opts.remote }, // 'debug' default means a handler just works; set 'off' explicitly to disable\n };\n\n /* ---- helpers ---- */\n\n const passes = (type: LogLevel): boolean => PRIORITY[cfg.logLevel] <= PRIORITY[type];\n\n const ts = (): string => new Date().toISOString().slice(11, 23);\n\n const badge = (type: LogType | 'group'): string => {\n const theme = THEME[type];\n\n if (cfg.variant === 'text' || !theme[cfg.variant]) return type.toUpperCase();\n\n return theme[cfg.variant]!;\n };\n\n const style = (type: LogType | 'group' | 'ns', extra = ''): string => {\n const { bg, border, color } = THEME[type];\n const base = `border: 1px solid ${border}; border-radius: 4px`;\n\n switch (cfg.variant) {\n case 'icon':\n return `color: ${bg}; ${base}; padding: 0 3px${extra}`;\n case 'symbol':\n return `color: ${bg}; ${base}; padding: 0 1px${extra}`;\n default:\n return `background: ${bg}; color: ${color}; ${base}; font-weight: bold; padding: 0 3px${extra}`;\n }\n };\n\n const emitNode = (type: LogType, ns: string, stamp: string, args: unknown[]): void => {\n const meta = [badge(type)];\n\n if (cfg.environment) meta.push(ENV_BADGE);\n\n if (ns) meta.push(`[${ns}]`);\n\n if (stamp) meta.push(stamp);\n\n const method = console[LOG_METHOD[type]] as (...a: unknown[]) => void;\n\n method(`${meta.join(' | ')} |`, ...args);\n };\n\n const emitBrowser = (type: LogType, ns: string, stamp: string, args: unknown[]): void => {\n let fmt = `%c${badge(type)}%c`;\n const parts: string[] = [style(type), ''];\n\n if (ns) {\n fmt += ` %c${ns}%c`;\n parts.push(style('ns', `; ${NS_STYLE}`), '');\n }\n\n if (cfg.environment) {\n fmt += ` %c${ENV_BADGE}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (stamp) {\n fmt += ` %c${stamp}%c`;\n parts.push('color: gray', '');\n }\n\n const method = console[LOG_METHOD[type]] as (...a: unknown[]) => void;\n\n method(fmt, ...parts, ...args);\n };\n\n const emit = (type: LogType, args: unknown[]): void => {\n if (!passes(type)) return;\n\n const ns = cfg.namespace;\n const stamp = cfg.timestamp ? ts() : '';\n\n if (IS_NODE) emitNode(type, ns, stamp, args);\n else emitBrowser(type, ns, stamp, args);\n\n /* remote dispatch — snapshot data now, dispatch in microtask to avoid blocking caller */\n const { handler, logLevel } = cfg.remote;\n\n if (handler && PRIORITY[logLevel] <= PRIORITY[type]) {\n const data: RemoteLogData = {\n args,\n env: IS_PROD ? 'production' : 'development',\n namespace: ns || undefined,\n timestamp: cfg.timestamp ? new Date().toISOString() : undefined,\n };\n\n Promise.resolve()\n .then(() => handler(type, data))\n .catch(() => {});\n }\n };\n\n const timeLabel = (label: string): string => (cfg.namespace ? `[${cfg.namespace}] ${label}` : label);\n\n /* ---- child factory ---- */\n const makeChild = (overrides: LogitOptions = {}): Logger => {\n const { remote: overrideRemote, ...overrideRest } = overrides;\n\n return createLogger({ ...cfg, ...overrideRest, remote: { ...cfg.remote, ...overrideRemote } });\n };\n\n /* ---- group renderer ---- */\n\n const renderGroupNode = (collapsed: boolean, label: string, ns: string, stamp: string): void => {\n const fn = collapsed ? console.groupCollapsed : console.group;\n const meta = [badge('group')];\n\n if (cfg.environment) meta.push(ENV_BADGE);\n\n meta.push(label);\n\n if (ns) meta.push(`[${ns}]`);\n\n if (stamp) meta.push(stamp);\n\n fn(meta.join(' | '));\n };\n\n const renderGroupBrowser = (collapsed: boolean, label: string, ns: string, stamp: string): void => {\n const fn = collapsed ? console.groupCollapsed : console.group;\n let fmt = `%c${label}%c`;\n const parts: string[] = [style('group', '; margin-right: 6px; padding: 1px 3px 0'), ''];\n\n if (ns) {\n fmt += ` %c${ns}%c`;\n parts.push(style('ns', `; ${NS_STYLE}; margin-right: 6px`), '');\n }\n\n if (cfg.environment) {\n fmt += ` %c${ENV_BADGE}%c`;\n parts.push('color: darkgray; margin-right: 6px', '');\n }\n\n if (stamp) {\n fmt += ` %c${stamp}%c`;\n parts.push('color: gray; font-weight: lighter; margin-right: 6px', '');\n }\n\n fn(fmt, ...parts);\n };\n\n const renderGroup = (collapsed: boolean, label: string): void => {\n const ns = cfg.namespace;\n const stamp = cfg.timestamp ? ts() : '';\n\n if (IS_NODE) renderGroupNode(collapsed, label, ns, stamp);\n else renderGroupBrowser(collapsed, label, ns, stamp);\n };\n\n /* ---- public API ---- */\n\n const logger: Logger = {\n assert: (condition: boolean, ...args: unknown[]): void => {\n if (passes('error')) console.assert(condition, ...args);\n },\n\n child: makeChild,\n\n get config(): Readonly<LogitConfig> {\n return { ...cfg, remote: { ...cfg.remote } };\n },\n\n debug: (...a) => emit('debug', a),\n\n enabled: (type: LogLevel): boolean => passes(type),\n error: (...a) => emit('error', a),\n\n group: <T>(label: string, fn: () => T, collapsed = false): T => {\n if (!passes('debug')) return fn();\n\n renderGroup(collapsed, label);\n\n try {\n const result = fn();\n\n if (result instanceof Promise) {\n return result.finally(() => console.groupEnd()) as T;\n }\n\n console.groupEnd();\n\n return result;\n } catch (e) {\n console.groupEnd();\n throw e;\n }\n },\n\n info: (...a) => emit('info', a),\n\n scope: (name: string): Logger => makeChild({ namespace: cfg.namespace ? `${cfg.namespace}.${name}` : name }),\n\n setConfig: (opts: LogitOptions): Logger => {\n const { remote, ...rest } = opts;\n\n if (remote !== undefined) Object.assign(cfg.remote, remote);\n\n Object.assign(cfg, rest);\n\n return logger;\n },\n success: (...a) => emit('success', a),\n\n table: (data: unknown, properties?: string[]): void => {\n if (passes('debug')) console.table(data, properties);\n },\n\n time: <T>(label: string, fn: () => T): T => {\n if (!passes('debug')) return fn();\n\n const tl = timeLabel(label);\n\n console.time(tl);\n\n try {\n const result = fn();\n\n if (result instanceof Promise) {\n return result.finally(() => console.timeEnd(tl)) as T;\n }\n\n console.timeEnd(tl);\n\n return result;\n } catch (e) {\n console.timeEnd(tl);\n throw e;\n }\n },\n\n trace: (...a) => emit('trace', a),\n warn: (...a) => emit('warn', a),\n };\n\n return logger;\n}\n\n/* -------------------- Default instance -------------------- */\n\n/**\n * Shared default logger instance. For isolated configurations use `createLogger()`.\n *\n * @example\n * ```ts\n * import { Logit } from '@vielzeug/logit';\n * Logit.info('Hello');\n * ```\n */\nexport const Logit = createLogger();\n"],"mappings":";AAkDA,IAAM,IAAqC;CACzC,OAAO;CACP,OAAO;CACP,MAAM;CACN,KAAK;CACL,SAAS;CACT,OAAO;CACP,MAAM;CACP,EAQK,IAAiD;CACrD,OAAO;EAAE,IAAI;EAAW,QAAQ;EAAW,OAAO;EAAQ,MAAM;EAAK,QAAQ;EAAM;CACnF,OAAO;EAAE,IAAI;EAAW,QAAQ;EAAW,OAAO;EAAQ,MAAM;EAAK,QAAQ;EAAM;CACnF,OAAO;EAAE,IAAI;EAAW,QAAQ;EAAW,OAAO;EAAQ,MAAM;EAAK,QAAQ;EAAM;CACnF,MAAM;EAAE,IAAI;EAAW,QAAQ;EAAW,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AAE3B,WAAQ,KAAK,EAAG;AAEhB,OAAI;IACF,IAAM,IAAS,GAAI;AAQnB,WANI,aAAkB,UACb,EAAO,cAAc,QAAQ,QAAQ,EAAG,CAAC,IAGlD,QAAQ,QAAQ,EAAG,EAEZ;YACA,GAAG;AAEV,UADA,QAAQ,QAAQ,EAAG,EACb;;;EAIV,QAAQ,GAAG,MAAM,EAAK,SAAS,EAAE;EACjC,OAAO,GAAG,MAAM,EAAK,QAAQ,EAAE;EAChC;AAED,QAAO;;AAcT,IAAa,IAAQ,GAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/logit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
13
15
|
"import": "./dist/index.js",
|
|
14
16
|
"require": "./dist/index.cjs"
|
|
15
17
|
}
|
|
16
18
|
},
|
|
17
19
|
"scripts": {
|
|
18
|
-
"build": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"build": "vite build && pnpm run build:types",
|
|
21
|
+
"build:types": "tsc -p tsconfig.declarations.json",
|
|
22
|
+
"fix": "eslint --fix src",
|
|
23
|
+
"lint": "eslint src",
|
|
24
|
+
"prepublishOnly": "pnpm run build",
|
|
22
25
|
"preview": "vite preview",
|
|
23
26
|
"test": "vitest"
|
|
24
27
|
},
|
|
@@ -27,9 +30,9 @@
|
|
|
27
30
|
"registry": "https://registry.npmjs.org/"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"vite
|
|
33
|
-
"vitest": "^4.
|
|
33
|
+
"@types/node": "^25.5.0",
|
|
34
|
+
"typescript": "~6.0.2",
|
|
35
|
+
"vite": "^8.0.2",
|
|
36
|
+
"vitest": "^4.1.1"
|
|
34
37
|
}
|
|
35
38
|
}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|