@vielzeug/fetchit 1.0.4 → 1.1.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/README.md +511 -0
- package/dist/fetchit.cjs +1 -1
- package/dist/fetchit.cjs.map +1 -1
- package/dist/fetchit.js +344 -164
- package/dist/fetchit.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +140 -66
- package/dist/index.js +4 -6
- package/dist/toolkit/dist/async/retry.cjs +2 -0
- package/dist/toolkit/dist/async/retry.cjs.map +1 -0
- package/dist/toolkit/dist/async/retry.js +25 -0
- package/dist/toolkit/dist/async/retry.js.map +1 -0
- package/dist/toolkit/dist/async/sleep.cjs +2 -0
- package/dist/toolkit/dist/async/sleep.cjs.map +1 -0
- package/dist/toolkit/dist/async/sleep.js +12 -0
- package/dist/toolkit/dist/async/sleep.js.map +1 -0
- package/dist/toolkit/dist/function/assert.cjs +3 -0
- package/dist/toolkit/dist/function/assert.cjs.map +1 -0
- package/dist/toolkit/dist/function/assert.js +12 -0
- package/dist/toolkit/dist/function/assert.js.map +1 -0
- package/dist/toolkit/dist/logit/dist/logit.cjs +2 -0
- package/dist/toolkit/dist/logit/dist/logit.cjs.map +1 -0
- package/dist/toolkit/dist/logit/dist/logit.js +263 -0
- package/dist/toolkit/dist/logit/dist/logit.js.map +1 -0
- package/package.json +3 -2
- package/dist/logit/dist/logit.cjs +0 -2
- package/dist/logit/dist/logit.cjs.map +0 -1
- package/dist/logit/dist/logit.js +0 -180
- package/dist/logit/dist/logit.js.map +0 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
const $ = {}, h = {
|
|
2
|
+
debug: "log",
|
|
3
|
+
success: "log"
|
|
4
|
+
}, w = () => typeof window < "u" && $?.NODE_ENV ? !1 : typeof process < "u" && process.env?.NODE_ENV ? process.env.NODE_ENV === "production" : !1, d = w(), x = typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches, b = {
|
|
5
|
+
debug: { bg: "#616161", border: "#424242", color: "#fff", icon: "☕", symbol: "🅳" },
|
|
6
|
+
error: { bg: "#d32f2f", border: "#c62828", color: "#fff", icon: "✘", symbol: "🅴" },
|
|
7
|
+
group: { bg: "#546e7a", border: "#455a64", color: "#fff", icon: "⚭", symbol: "🅶" },
|
|
8
|
+
info: { bg: "#1976d2", border: "#1565c0", color: "#fff", icon: "ℹ", symbol: "🅸" },
|
|
9
|
+
ns: x ? { bg: "#fafafa", border: "#c7c7c7", color: "#000" } : { bg: "#424242", border: "#212121", color: "#fff" },
|
|
10
|
+
success: { bg: "#689f38", border: "#558b2f", color: "#fff", icon: "✔", symbol: "🆂" },
|
|
11
|
+
time: { bg: "#0097a7", border: "#00838f", color: "#fff", icon: "⏲", symbol: "🆃" },
|
|
12
|
+
trace: { bg: "#d81b60", border: "#c2185b", color: "#fff", icon: "⛢", symbol: "🆃" },
|
|
13
|
+
warn: { bg: "#ffb300", border: "#ffa000", color: "#fff", icon: "⚠", symbol: "🆆" }
|
|
14
|
+
}, m = {
|
|
15
|
+
debug: 0,
|
|
16
|
+
trace: 1,
|
|
17
|
+
time: 2,
|
|
18
|
+
table: 3,
|
|
19
|
+
info: 4,
|
|
20
|
+
success: 5,
|
|
21
|
+
warn: 6,
|
|
22
|
+
error: 7,
|
|
23
|
+
off: 8
|
|
24
|
+
}, o = {
|
|
25
|
+
environment: !0,
|
|
26
|
+
logLevel: "debug",
|
|
27
|
+
namespace: "",
|
|
28
|
+
remote: { handler: void 0, logLevel: "off" },
|
|
29
|
+
timestamp: !0,
|
|
30
|
+
variant: "symbol"
|
|
31
|
+
}, i = (e) => m[o.logLevel] <= m[e], p = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), g = () => d ? "🄿" : "🄳", y = (e, r) => {
|
|
32
|
+
o.remote.handler && m[o.remote.logLevel] <= m[e] && Promise.resolve().then(() => {
|
|
33
|
+
o.remote.handler?.(e, {
|
|
34
|
+
args: r,
|
|
35
|
+
environment: d ? "production" : "development",
|
|
36
|
+
namespace: o.namespace || void 0,
|
|
37
|
+
timestamp: o.timestamp ? p() : void 0
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}, f = (e) => h[e] || e, L = "border: 1px solid", E = "border-radius: 4px", u = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;", l = (e, r = "") => {
|
|
41
|
+
const { bg: n, color: a, border: t } = b[e], s = `${L} ${t}; ${E}`;
|
|
42
|
+
switch (o.variant) {
|
|
43
|
+
case "symbol":
|
|
44
|
+
return `color: ${n}; ${s}; padding: 1px 1px 0${r}`;
|
|
45
|
+
case "icon":
|
|
46
|
+
return `color: ${n}; ${s}; padding: 0 3px${r}`;
|
|
47
|
+
default:
|
|
48
|
+
return `background: ${n}; color: ${a}; ${s}; font-weight: bold; padding: 0 3px${r}`;
|
|
49
|
+
}
|
|
50
|
+
}, v = (e) => {
|
|
51
|
+
const r = b[e], { variant: n } = o;
|
|
52
|
+
return n === "text" || !r || !r[n] ? e.toUpperCase() : r[n];
|
|
53
|
+
};
|
|
54
|
+
function D(e) {
|
|
55
|
+
const { namespace: r, timestamp: n, environment: a } = o;
|
|
56
|
+
let t = `%c${v(e)}%c`;
|
|
57
|
+
const s = [l(e), ""];
|
|
58
|
+
return r && (t += ` %c${r}%c`, s.push(l("ns", `; ${u}`), "")), a && (t += ` %c${g()}%c`, s.push("color: darkgray", "")), n && (t += ` %c${p()}%c`, s.push("color: gray", "")), { format: t, parts: s };
|
|
59
|
+
}
|
|
60
|
+
const c = (e, ...r) => {
|
|
61
|
+
if (typeof window > "u") {
|
|
62
|
+
const s = console[f(e)];
|
|
63
|
+
s(`${v(e)} | ${g()} |`, ...r);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!i(e)) return;
|
|
67
|
+
const { format: n, parts: a } = D(e), t = console[f(e)];
|
|
68
|
+
t(n, ...a, ...r), y(e, r);
|
|
69
|
+
}, N = (e) => {
|
|
70
|
+
const r = Math.floor(Date.now() - e);
|
|
71
|
+
return r ? `${r}ms` : "";
|
|
72
|
+
}, O = {
|
|
73
|
+
/**
|
|
74
|
+
* Asserts a condition and logs an error if it's false.
|
|
75
|
+
*/
|
|
76
|
+
assert: (e, r, n) => console.assert(e, r, n),
|
|
77
|
+
debug: (...e) => c("debug", ...e),
|
|
78
|
+
error: (...e) => c("error", ...e),
|
|
79
|
+
/**
|
|
80
|
+
* Gets whether the environment indicator is shown.
|
|
81
|
+
*/
|
|
82
|
+
getEnvironment: () => o.environment,
|
|
83
|
+
/**
|
|
84
|
+
* Gets the current log level.
|
|
85
|
+
*/
|
|
86
|
+
getLevel: () => o.logLevel,
|
|
87
|
+
/**
|
|
88
|
+
* Gets the current namespace prefix.
|
|
89
|
+
*/
|
|
90
|
+
getPrefix: () => o.namespace,
|
|
91
|
+
/**
|
|
92
|
+
* Gets whether timestamps are shown.
|
|
93
|
+
*/
|
|
94
|
+
getTimestamp: () => o.timestamp,
|
|
95
|
+
/**
|
|
96
|
+
* Gets the current display variant.
|
|
97
|
+
*/
|
|
98
|
+
getVariant: () => o.variant,
|
|
99
|
+
/**
|
|
100
|
+
* Creates a collapsed group in the console.
|
|
101
|
+
*/
|
|
102
|
+
groupCollapsed: (e, r = "GROUP", n = Date.now()) => {
|
|
103
|
+
if (!i("success")) return;
|
|
104
|
+
const a = N(n), t = g(), s = o.timestamp ? p() : "";
|
|
105
|
+
console.groupCollapsed(
|
|
106
|
+
`%c${r}%c${o.namespace}%c${t}%c${s}%c${a}%c${e}`,
|
|
107
|
+
l("group", "; margin-right: 6px; padding: 1px 3px 0"),
|
|
108
|
+
l("ns", `; ${u}; margin-right: 6px`),
|
|
109
|
+
"color: darkgray; margin-right: 6px",
|
|
110
|
+
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
111
|
+
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
112
|
+
"color: inherit; font-weight: lighter"
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Ends the current console group.
|
|
117
|
+
*/
|
|
118
|
+
groupEnd: () => {
|
|
119
|
+
i("success") && console.groupEnd();
|
|
120
|
+
},
|
|
121
|
+
info: (...e) => c("info", ...e),
|
|
122
|
+
/**
|
|
123
|
+
* Creates a scoped logger with a namespaced prefix.
|
|
124
|
+
* Does not mutate global state - returns an isolated logger instance.
|
|
125
|
+
*
|
|
126
|
+
* @param namespace - The namespace to prepend to all log messages
|
|
127
|
+
* @returns A scoped logger with all logging methods
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const apiLogger = Logit.scope('api');
|
|
132
|
+
* apiLogger.info('Request received'); // [API] Request received
|
|
133
|
+
*
|
|
134
|
+
* const dbLogger = Logit.scope('database');
|
|
135
|
+
* dbLogger.error('Connection failed'); // [DATABASE] Connection failed
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
scope: (e) => {
|
|
139
|
+
const r = o.namespace, n = r ? `${r}.${e}` : e;
|
|
140
|
+
return {
|
|
141
|
+
debug: (...a) => {
|
|
142
|
+
const t = o.namespace;
|
|
143
|
+
o.namespace = n, c("debug", ...a), o.namespace = t;
|
|
144
|
+
},
|
|
145
|
+
error: (...a) => {
|
|
146
|
+
const t = o.namespace;
|
|
147
|
+
o.namespace = n, c("error", ...a), o.namespace = t;
|
|
148
|
+
},
|
|
149
|
+
info: (...a) => {
|
|
150
|
+
const t = o.namespace;
|
|
151
|
+
o.namespace = n, c("info", ...a), o.namespace = t;
|
|
152
|
+
},
|
|
153
|
+
success: (...a) => {
|
|
154
|
+
const t = o.namespace;
|
|
155
|
+
o.namespace = n, c("success", ...a), o.namespace = t;
|
|
156
|
+
},
|
|
157
|
+
trace: (...a) => {
|
|
158
|
+
const t = o.namespace;
|
|
159
|
+
o.namespace = n, c("trace", ...a), o.namespace = t;
|
|
160
|
+
},
|
|
161
|
+
warn: (...a) => {
|
|
162
|
+
const t = o.namespace;
|
|
163
|
+
o.namespace = n, c("warn", ...a), o.namespace = t;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Sets the minimum log level to display.
|
|
169
|
+
*/
|
|
170
|
+
setLogLevel: (e) => {
|
|
171
|
+
o.logLevel = e;
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* Sets the namespace prefix for all logs.
|
|
175
|
+
*/
|
|
176
|
+
setPrefix: (e) => {
|
|
177
|
+
o.namespace = e;
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Configures remote logging options.
|
|
181
|
+
*/
|
|
182
|
+
setRemote: (e) => {
|
|
183
|
+
o.remote = e;
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Sets the log level for remote logging.
|
|
187
|
+
*/
|
|
188
|
+
setRemoteLogLevel: (e) => {
|
|
189
|
+
o.remote.logLevel = e;
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* Configures Logit with custom options.
|
|
193
|
+
*
|
|
194
|
+
* Note: The remote option will be merged with existing remote config,
|
|
195
|
+
* not replaced entirely. To clear a remote handler, set remote.handler to undefined.
|
|
196
|
+
*/
|
|
197
|
+
setup: (e) => {
|
|
198
|
+
e.remote && (o.remote = { ...o.remote, ...e.remote }, delete e.remote), Object.assign(o, e);
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Sets the display variant (text, icon, or symbol).
|
|
202
|
+
*/
|
|
203
|
+
setVariant: (e) => {
|
|
204
|
+
o.variant = e;
|
|
205
|
+
},
|
|
206
|
+
success: (...e) => c("success", ...e),
|
|
207
|
+
/**
|
|
208
|
+
* Displays data in a table format.
|
|
209
|
+
*/
|
|
210
|
+
table: (...e) => {
|
|
211
|
+
i("table") && console.table(...e);
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Starts a timer with the given label.
|
|
215
|
+
*/
|
|
216
|
+
time: (e) => {
|
|
217
|
+
i("time") && console.time(e);
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* Ends a timer with the given label.
|
|
221
|
+
*/
|
|
222
|
+
timeEnd: (e) => {
|
|
223
|
+
i("time") && console.timeEnd(e);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* Toggles or sets the environment indicator visibility.
|
|
227
|
+
* When called without arguments, toggles the current state.
|
|
228
|
+
*
|
|
229
|
+
* @param value - Optional boolean to explicitly set the state
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* Logit.toggleEnvironment(); // Toggles current state
|
|
234
|
+
* Logit.toggleEnvironment(true); // Shows environment indicator
|
|
235
|
+
* Logit.toggleEnvironment(false); // Hides environment indicator
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
toggleEnvironment: (e) => {
|
|
239
|
+
o.environment = e ?? !o.environment;
|
|
240
|
+
},
|
|
241
|
+
/**
|
|
242
|
+
* Toggles or sets timestamp visibility in logs.
|
|
243
|
+
* When called without arguments, toggles the current state.
|
|
244
|
+
*
|
|
245
|
+
* @param value - Optional boolean to explicitly set the state
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* Logit.toggleTimestamp(); // Toggles current state
|
|
250
|
+
* Logit.toggleTimestamp(true); // Shows timestamps
|
|
251
|
+
* Logit.toggleTimestamp(false); // Hides timestamps
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
toggleTimestamp: (e) => {
|
|
255
|
+
o.timestamp = e ?? !o.timestamp;
|
|
256
|
+
},
|
|
257
|
+
trace: (...e) => c("trace", ...e),
|
|
258
|
+
warn: (...e) => c("warn", ...e)
|
|
259
|
+
};
|
|
260
|
+
export {
|
|
261
|
+
O as Logit
|
|
262
|
+
};
|
|
263
|
+
//# sourceMappingURL=logit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logit.js","sources":["../../../../../../toolkit/dist/logit/dist/logit.js"],"sourcesContent":["const $ = {}, h = {\n debug: \"log\",\n success: \"log\"\n}, w = () => typeof window < \"u\" && $?.NODE_ENV ? !1 : typeof process < \"u\" && process.env?.NODE_ENV ? process.env.NODE_ENV === \"production\" : !1, d = w(), x = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, b = {\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: x ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", 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}, m = {\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}, o = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, i = (e) => m[o.logLevel] <= m[e], p = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), g = () => d ? \"🄿\" : \"🄳\", y = (e, r) => {\n o.remote.handler && m[o.remote.logLevel] <= m[e] && Promise.resolve().then(() => {\n o.remote.handler?.(e, {\n args: r,\n environment: d ? \"production\" : \"development\",\n namespace: o.namespace || void 0,\n timestamp: o.timestamp ? p() : void 0\n });\n });\n}, f = (e) => h[e] || e, L = \"border: 1px solid\", E = \"border-radius: 4px\", u = \"border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;\", l = (e, r = \"\") => {\n const { bg: t, color: s, border: n } = b[e], a = `${L} ${n}; ${E}`;\n switch (o.variant) {\n case \"symbol\":\n return `color: ${t}; ${a}; padding: 1px 1px 0${r}`;\n case \"icon\":\n return `color: ${t}; ${a}; padding: 0 3px${r}`;\n default:\n return `background: ${t}; color: ${s}; ${a}; font-weight: bold; padding: 0 3px${r}`;\n }\n}, v = (e) => {\n const r = b[e], { variant: t } = o;\n return t === \"text\" || !r || !r[t] ? e.toUpperCase() : r[t];\n};\nfunction D(e) {\n const { namespace: r, timestamp: t, environment: s } = o;\n let n = `%c${v(e)}%c`;\n const a = [l(e), \"\"];\n return r && (n += ` %c${r}%c`, a.push(l(\"ns\", `; ${u}`), \"\")), s && (n += ` %c${g()}%c`, a.push(\"color: darkgray\", \"\")), t && (n += ` %c${p()}%c`, a.push(\"color: gray\", \"\")), { format: n, parts: a };\n}\nconst c = (e, ...r) => {\n if (typeof window > \"u\") {\n const a = console[f(e)];\n a(`${v(e)} | ${g()} |`, ...r);\n return;\n }\n if (!i(e)) return;\n const { format: t, parts: s } = D(e), n = console[f(e)];\n n(t, ...s, ...r), y(e, r);\n}, N = (e) => {\n const r = Math.floor(Date.now() - e);\n return r ? `${r}ms` : \"\";\n}, O = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (e, r, t) => console.assert(e, r, t),\n debug: (...e) => c(\"debug\", ...e),\n error: (...e) => c(\"error\", ...e),\n /**\n * Gets whether the environment indicator is shown.\n */\n getEnvironment: () => o.environment,\n /**\n * Gets the current log level.\n */\n getLevel: () => o.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => o.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => o.timestamp,\n /**\n * Gets the current display variant.\n */\n getVariant: () => o.variant,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (e, r = \"GROUP\", t = Date.now()) => {\n if (!i(\"success\")) return;\n const s = N(t), n = g(), a = o.timestamp ? p() : \"\";\n console.groupCollapsed(\n `%c${r}%c${o.namespace}%c${n}%c${a}%c${s}%c${e}`,\n l(\"group\", \"; margin-right: 6px; padding: 1px 3px 0\"),\n l(\"ns\", `; ${u}; 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 * Ends the current console group.\n */\n groupEnd: () => {\n i(\"success\") && console.groupEnd();\n },\n info: (...e) => c(\"info\", ...e),\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: (e) => {\n const r = o.namespace, t = r ? `${r}.${e}` : e;\n return {\n debug: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"debug\", ...s), o.namespace = n;\n },\n error: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"error\", ...s), o.namespace = n;\n },\n info: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"info\", ...s), o.namespace = n;\n },\n success: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"success\", ...s), o.namespace = n;\n },\n trace: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"trace\", ...s), o.namespace = n;\n },\n warn: (...s) => {\n const n = o.namespace;\n o.namespace = t, c(\"warn\", ...s), o.namespace = n;\n }\n };\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (e) => {\n o.logLevel = e;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (e) => {\n o.namespace = e;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (e) => {\n o.remote = e;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (e) => {\n o.remote.logLevel = e;\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: (e) => {\n e.remote && (o.remote = { ...o.remote, ...e.remote }, delete e.remote), Object.assign(o, e);\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (e) => {\n o.variant = e;\n },\n success: (...e) => c(\"success\", ...e),\n /**\n * Displays data in a table format.\n */\n table: (...e) => {\n i(\"table\") && console.table(...e);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (e) => {\n i(\"time\") && console.time(e);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (e) => {\n i(\"time\") && console.timeEnd(e);\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: (e) => {\n o.environment = e ?? !o.environment;\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: (e) => {\n o.timestamp = e ?? !o.timestamp;\n },\n trace: (...e) => c(\"trace\", ...e),\n warn: (...e) => c(\"warn\", ...e)\n};\nexport {\n O as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|
"registry": "https://registry.npmjs.org/"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@vielzeug/logit": "workspace:*"
|
|
30
|
+
"@vielzeug/logit": "workspace:*",
|
|
31
|
+
"@vielzeug/toolkit": "workspace:*"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"typescript": "~5.9.3",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w={},v={debug:"log",success:"log"},y=()=>typeof window<"u"&&w?.NODE_ENV?!1:typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="production":!1,x=y(),L=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,b={debug:{bg:"#616161",border:"#424242",color:"#fff",icon:"☕",symbol:"🅳"},error:{bg:"#d32f2f",border:"#c62828",color:"#fff",icon:"✘",symbol:"🅴"},group:{bg:"#546e7a",border:"#455a64",color:"#fff",icon:"⚭",symbol:"🅶"},info:{bg:"#1976d2",border:"#1565c0",color:"#fff",icon:"ℹ",symbol:"🅸"},ns:L?{bg:"#fafafa",border:"#c7c7c7",color:"#000"}:{bg:"#424242",border:"#212121",color:"#fff"},success:{bg:"#689f38",border:"#558b2f",color:"#fff",icon:"✔",symbol:"🆂"},time:{bg:"#0097a7",border:"#00838f",color:"#fff",icon:"⏲",symbol:"🆃"},trace:{bg:"#d81b60",border:"#c2185b",color:"#fff",icon:"⛢",symbol:"🆃"},warn:{bg:"#ffb300",border:"#ffa000",color:"#fff",icon:"⚠",symbol:"🆆"}},l={debug:0,trace:1,time:2,table:3,info:4,success:5,warn:6,error:7,off:8},r={environment:!0,logLevel:"debug",namespace:"",remote:{handler:void 0,logLevel:"off"},timestamp:!0,variant:"symbol"},i=e=>l[r.logLevel]<=l[e],u=()=>new Date().toISOString().slice(11,23),g=()=>x?"🄿":"🄳",E=(e,o)=>{r.remote.handler&&l[r.remote.logLevel]<=l[e]&&r.remote.handler(e,...o)},m=e=>v[e]||e,d="border: 1px solid",p="border-radius: 4px",$="border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter",f=(e,o="")=>{const{bg:t,color:c,border:n}=b[e],s=`color: ${t}; ${d} ${n}; ${p}`;switch(r.variant){case"symbol":return`${s}; padding: 1px 1px 0${o}`;case"icon":return`${s}; padding: 0 3px${o}`;default:return`background: ${t}; color: ${c}; ${d} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`}},h=e=>{const o=b[e],{variant:t}=r;return t==="text"||!o[t]?e.toUpperCase():o[t]};function O(e){const{namespace:o,timestamp:t,environment:c}=r;let n=`%c${h(e)}%c`;const s=[f(e),""];return o&&(n+=` %c${o}%c`,s.push(f("ns",`; ${$}`),"")),c&&(n+=` %c${g()}%c`,s.push("color: darkgray","")),t&&(n+=` %c${u()}%c`,s.push("color: gray","")),{format:n,parts:s}}const a=(e,...o)=>{if(typeof window>"u"){const s=console[m(e)];s(`${h(e)} | ${g()} |`,...o);return}if(!i(e))return;const{format:t,parts:c}=O(e),n=console[m(e)];n(t,...c,...o),E(e,o)},D=e=>{const o=Math.floor(Date.now()-e);return o?`${o}ms`:""},N={assert:(e,o,t)=>console.assert(e,o,t),debug:(...e)=>a("debug",...e),error:(...e)=>a("error",...e),getLevel:()=>r.logLevel,getPrefix:()=>r.namespace,getTimestamp:()=>r.timestamp,groupCollapsed:(e,o="GROUP",t=Date.now())=>{if(!i("success"))return;const c=D(t),n=g(),s=r.timestamp?u():"";console.groupCollapsed(`%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,f("group","; margin-right: 6px; padding: 1px 3px 0"),f("ns",`; ${$}; margin-right: 6px`),"color: darkgray; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: inherit; font-weight: lighter")},groupEnd:()=>{i("success")&&console.groupEnd()},info:(...e)=>a("info",...e),initialise:e=>{Object.assign(r,e)},setLogLevel:e=>{r.logLevel=e},setPrefix:e=>{r.namespace=e},setRemote:e=>{r.remote=e},setRemoteLogLevel:e=>{r.remote.logLevel=e},setVariant:e=>{r.variant=e},showEnvironment:e=>{r.environment=e},showTimestamp:e=>{r.timestamp=e},success:(...e)=>a("success",...e),table:(...e)=>{i("table")&&console.table(...e)},time:e=>{i("time")&&console.time(e)},timeEnd:e=>{i("time")&&console.timeEnd(e)},trace:(...e)=>a("trace",...e),warn:(...e)=>a("warn",...e)};exports.Logit=N;
|
|
2
|
-
//# sourceMappingURL=logit.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logit.cjs","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const $ = {};\nconst v = {\n debug: \"log\",\n success: \"log\"\n}, w = () => typeof window < \"u\" && $?.NODE_ENV ? !1 : typeof process < \"u\" && process.env?.NODE_ENV ? process.env.NODE_ENV === \"production\" : !1, _ = w(), L = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, b = {\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: L ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", 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}, l = {\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}, r = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, a = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), d = () => _ ? \"🄿\" : \"🄳\", x = (e, o) => {\n r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);\n}, g = (e) => v[e] || e, m = \"border: 1px solid\", p = \"border-radius: 4px\", h = \"border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter\", f = (e, o = \"\") => {\n const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${m} ${n}; ${p}`;\n switch (r.variant) {\n case \"symbol\":\n return `${s}; padding: 1px 1px 0${o}`;\n case \"icon\":\n return `${s}; padding: 0 3px${o}`;\n default:\n return `background: ${t}; color: ${c}; ${m} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;\n }\n}, E = (e) => {\n const o = b[e], { variant: t } = r;\n return t === \"text\" || !o[t] ? e.toUpperCase() : o[t];\n};\nfunction D(e) {\n const { namespace: o, timestamp: t, environment: c } = r;\n let n = `%c${E(e)}%c`;\n const s = [f(e), \"\"];\n return o && (n += ` %c${o}%c`, s.push(f(\"ns\", `; ${h}`), \"\")), c && (n += ` %c${d()}%c`, s.push(\"color: darkgray\", \"\")), t && (n += ` %c${u()}%c`, s.push(\"color: gray\", \"\")), { format: n, parts: s };\n}\nconst i = (e, ...o) => {\n if (typeof window > \"u\") {\n const s = console[g(e)];\n s(`${E(e)} | ${d()} |`, ...o);\n return;\n }\n if (!a(e)) return;\n const { format: t, parts: c } = D(e), n = console[g(e)];\n n(t, ...c, ...o), x(e, o);\n}, O = (e) => {\n const o = Math.floor(Date.now() - e);\n return o ? `${o}ms` : \"\";\n}, y = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (e, o, t) => console.assert(e, o, t),\n debug: (...e) => i(\"debug\", ...e),\n error: (...e) => i(\"error\", ...e),\n /**\n * Gets the current log level.\n */\n getLevel: () => r.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => r.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => r.timestamp,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (e, o = \"GROUP\", t = Date.now()) => {\n if (!a(\"success\")) return;\n const c = O(t), n = d(), s = r.timestamp ? u() : \"\";\n console.groupCollapsed(\n `%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,\n f(\"group\", \"; margin-right: 6px; padding: 1px 3px 0\"),\n f(\"ns\", `; ${h}; 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 * Ends the current console group.\n */\n groupEnd: () => {\n a(\"success\") && console.groupEnd();\n },\n info: (...e) => i(\"info\", ...e),\n /**\n * Initializes Logit with custom options.\n */\n initialise: (e) => {\n Object.assign(r, e);\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (e) => {\n r.logLevel = e;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (e) => {\n r.namespace = e;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (e) => {\n r.remote = e;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (e) => {\n r.remote.logLevel = e;\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (e) => {\n r.variant = e;\n },\n /**\n * Shows or hides the environment indicator.\n */\n showEnvironment: (e) => {\n r.environment = e;\n },\n /**\n * Shows or hides timestamps in logs.\n */\n showTimestamp: (e) => {\n r.timestamp = e;\n },\n success: (...e) => i(\"success\", ...e),\n /**\n * Displays data in a table format.\n */\n table: (...e) => {\n a(\"table\") && console.table(...e);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (e) => {\n a(\"time\") && console.time(e);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (e) => {\n a(\"time\") && console.timeEnd(e);\n },\n trace: (...e) => i(\"trace\", ...e),\n warn: (...e) => i(\"warn\", ...e)\n};\nexport {\n y as Logit\n};\n//# sourceMappingURL=logit.js.map\n"],"names":["$","w","_","a","d","x","g","m","h","E","D","i","O","y"],"mappings":"gFAAA,MAAMA,EAAI,CAAA,EACJ,EAAI,CACR,MAAO,MACP,QAAS,KACX,EAAGC,EAAI,IAAM,OAAO,OAAS,KAAOD,GAAG,SAAW,GAAK,OAAO,QAAU,KAAO,QAAQ,KAAK,SAAW,QAAQ,IAAI,WAAa,aAAe,GAAIE,EAAID,EAAC,EAAI,EAAI,OAAO,OAAS,KAAO,OAAO,aAAa,8BAA8B,EAAE,QAAS,EAAI,CACtP,MAAO,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,EACjF,MAAO,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,EACjF,MAAO,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,EACjF,KAAM,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,EAChF,GAAI,EAAI,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,MAAM,EAAK,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,MAAM,EAC/G,QAAS,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,EACnF,KAAM,CAAE,GAAI,UAAW,OAAQ,UAAW,MAAO,OAAQ,KAAM,IAAK,OAAQ,IAAI,E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Q,EAAE,QAAS,GAAG,CAAC,EAChC,KAAM,IAAI,IAAMA,EAAE,OAAQ,GAAG,CAAC,CAChC"}
|
package/dist/logit/dist/logit.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
const w = {}, v = {
|
|
2
|
-
debug: "log",
|
|
3
|
-
success: "log"
|
|
4
|
-
}, x = () => typeof window < "u" && w?.NODE_ENV ? !1 : typeof process < "u" && process.env?.NODE_ENV ? process.env.NODE_ENV === "production" : !1, y = x(), L = typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches, b = {
|
|
5
|
-
debug: { bg: "#616161", border: "#424242", color: "#fff", icon: "☕", symbol: "🅳" },
|
|
6
|
-
error: { bg: "#d32f2f", border: "#c62828", color: "#fff", icon: "✘", symbol: "🅴" },
|
|
7
|
-
group: { bg: "#546e7a", border: "#455a64", color: "#fff", icon: "⚭", symbol: "🅶" },
|
|
8
|
-
info: { bg: "#1976d2", border: "#1565c0", color: "#fff", icon: "ℹ", symbol: "🅸" },
|
|
9
|
-
ns: L ? { bg: "#fafafa", border: "#c7c7c7", color: "#000" } : { bg: "#424242", border: "#212121", color: "#fff" },
|
|
10
|
-
success: { bg: "#689f38", border: "#558b2f", color: "#fff", icon: "✔", symbol: "🆂" },
|
|
11
|
-
time: { bg: "#0097a7", border: "#00838f", color: "#fff", icon: "⏲", symbol: "🆃" },
|
|
12
|
-
trace: { bg: "#d81b60", border: "#c2185b", color: "#fff", icon: "⛢", symbol: "🆃" },
|
|
13
|
-
warn: { bg: "#ffb300", border: "#ffa000", color: "#fff", icon: "⚠", symbol: "🆆" }
|
|
14
|
-
}, l = {
|
|
15
|
-
debug: 0,
|
|
16
|
-
trace: 1,
|
|
17
|
-
time: 2,
|
|
18
|
-
table: 3,
|
|
19
|
-
info: 4,
|
|
20
|
-
success: 5,
|
|
21
|
-
warn: 6,
|
|
22
|
-
error: 7,
|
|
23
|
-
off: 8
|
|
24
|
-
}, r = {
|
|
25
|
-
environment: !0,
|
|
26
|
-
logLevel: "debug",
|
|
27
|
-
namespace: "",
|
|
28
|
-
remote: { handler: void 0, logLevel: "off" },
|
|
29
|
-
timestamp: !0,
|
|
30
|
-
variant: "symbol"
|
|
31
|
-
}, i = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), g = () => y ? "🄿" : "🄳", E = (e, o) => {
|
|
32
|
-
r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);
|
|
33
|
-
}, m = (e) => v[e] || e, d = "border: 1px solid", p = "border-radius: 4px", $ = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter", f = (e, o = "") => {
|
|
34
|
-
const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${d} ${n}; ${p}`;
|
|
35
|
-
switch (r.variant) {
|
|
36
|
-
case "symbol":
|
|
37
|
-
return `${s}; padding: 1px 1px 0${o}`;
|
|
38
|
-
case "icon":
|
|
39
|
-
return `${s}; padding: 0 3px${o}`;
|
|
40
|
-
default:
|
|
41
|
-
return `background: ${t}; color: ${c}; ${d} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;
|
|
42
|
-
}
|
|
43
|
-
}, h = (e) => {
|
|
44
|
-
const o = b[e], { variant: t } = r;
|
|
45
|
-
return t === "text" || !o[t] ? e.toUpperCase() : o[t];
|
|
46
|
-
};
|
|
47
|
-
function D(e) {
|
|
48
|
-
const { namespace: o, timestamp: t, environment: c } = r;
|
|
49
|
-
let n = `%c${h(e)}%c`;
|
|
50
|
-
const s = [f(e), ""];
|
|
51
|
-
return o && (n += ` %c${o}%c`, s.push(f("ns", `; ${$}`), "")), c && (n += ` %c${g()}%c`, s.push("color: darkgray", "")), t && (n += ` %c${u()}%c`, s.push("color: gray", "")), { format: n, parts: s };
|
|
52
|
-
}
|
|
53
|
-
const a = (e, ...o) => {
|
|
54
|
-
if (typeof window > "u") {
|
|
55
|
-
const s = console[m(e)];
|
|
56
|
-
s(`${h(e)} | ${g()} |`, ...o);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!i(e)) return;
|
|
60
|
-
const { format: t, parts: c } = D(e), n = console[m(e)];
|
|
61
|
-
n(t, ...c, ...o), E(e, o);
|
|
62
|
-
}, O = (e) => {
|
|
63
|
-
const o = Math.floor(Date.now() - e);
|
|
64
|
-
return o ? `${o}ms` : "";
|
|
65
|
-
}, N = {
|
|
66
|
-
/**
|
|
67
|
-
* Asserts a condition and logs an error if it's false.
|
|
68
|
-
*/
|
|
69
|
-
assert: (e, o, t) => console.assert(e, o, t),
|
|
70
|
-
debug: (...e) => a("debug", ...e),
|
|
71
|
-
error: (...e) => a("error", ...e),
|
|
72
|
-
/**
|
|
73
|
-
* Gets the current log level.
|
|
74
|
-
*/
|
|
75
|
-
getLevel: () => r.logLevel,
|
|
76
|
-
/**
|
|
77
|
-
* Gets the current namespace prefix.
|
|
78
|
-
*/
|
|
79
|
-
getPrefix: () => r.namespace,
|
|
80
|
-
/**
|
|
81
|
-
* Gets whether timestamps are shown.
|
|
82
|
-
*/
|
|
83
|
-
getTimestamp: () => r.timestamp,
|
|
84
|
-
/**
|
|
85
|
-
* Creates a collapsed group in the console.
|
|
86
|
-
*/
|
|
87
|
-
groupCollapsed: (e, o = "GROUP", t = Date.now()) => {
|
|
88
|
-
if (!i("success")) return;
|
|
89
|
-
const c = O(t), n = g(), s = r.timestamp ? u() : "";
|
|
90
|
-
console.groupCollapsed(
|
|
91
|
-
`%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,
|
|
92
|
-
f("group", "; margin-right: 6px; padding: 1px 3px 0"),
|
|
93
|
-
f("ns", `; ${$}; margin-right: 6px`),
|
|
94
|
-
"color: darkgray; margin-right: 6px",
|
|
95
|
-
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
96
|
-
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
97
|
-
"color: inherit; font-weight: lighter"
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* Ends the current console group.
|
|
102
|
-
*/
|
|
103
|
-
groupEnd: () => {
|
|
104
|
-
i("success") && console.groupEnd();
|
|
105
|
-
},
|
|
106
|
-
info: (...e) => a("info", ...e),
|
|
107
|
-
/**
|
|
108
|
-
* Initializes Logit with custom options.
|
|
109
|
-
*/
|
|
110
|
-
initialise: (e) => {
|
|
111
|
-
Object.assign(r, e);
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Sets the minimum log level to display.
|
|
115
|
-
*/
|
|
116
|
-
setLogLevel: (e) => {
|
|
117
|
-
r.logLevel = e;
|
|
118
|
-
},
|
|
119
|
-
/**
|
|
120
|
-
* Sets the namespace prefix for all logs.
|
|
121
|
-
*/
|
|
122
|
-
setPrefix: (e) => {
|
|
123
|
-
r.namespace = e;
|
|
124
|
-
},
|
|
125
|
-
/**
|
|
126
|
-
* Configures remote logging options.
|
|
127
|
-
*/
|
|
128
|
-
setRemote: (e) => {
|
|
129
|
-
r.remote = e;
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* Sets the log level for remote logging.
|
|
133
|
-
*/
|
|
134
|
-
setRemoteLogLevel: (e) => {
|
|
135
|
-
r.remote.logLevel = e;
|
|
136
|
-
},
|
|
137
|
-
/**
|
|
138
|
-
* Sets the display variant (text, icon, or symbol).
|
|
139
|
-
*/
|
|
140
|
-
setVariant: (e) => {
|
|
141
|
-
r.variant = e;
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* Shows or hides the environment indicator.
|
|
145
|
-
*/
|
|
146
|
-
showEnvironment: (e) => {
|
|
147
|
-
r.environment = e;
|
|
148
|
-
},
|
|
149
|
-
/**
|
|
150
|
-
* Shows or hides timestamps in logs.
|
|
151
|
-
*/
|
|
152
|
-
showTimestamp: (e) => {
|
|
153
|
-
r.timestamp = e;
|
|
154
|
-
},
|
|
155
|
-
success: (...e) => a("success", ...e),
|
|
156
|
-
/**
|
|
157
|
-
* Displays data in a table format.
|
|
158
|
-
*/
|
|
159
|
-
table: (...e) => {
|
|
160
|
-
i("table") && console.table(...e);
|
|
161
|
-
},
|
|
162
|
-
/**
|
|
163
|
-
* Starts a timer with the given label.
|
|
164
|
-
*/
|
|
165
|
-
time: (e) => {
|
|
166
|
-
i("time") && console.time(e);
|
|
167
|
-
},
|
|
168
|
-
/**
|
|
169
|
-
* Ends a timer with the given label.
|
|
170
|
-
*/
|
|
171
|
-
timeEnd: (e) => {
|
|
172
|
-
i("time") && console.timeEnd(e);
|
|
173
|
-
},
|
|
174
|
-
trace: (...e) => a("trace", ...e),
|
|
175
|
-
warn: (...e) => a("warn", ...e)
|
|
176
|
-
};
|
|
177
|
-
export {
|
|
178
|
-
N as Logit
|
|
179
|
-
};
|
|
180
|
-
//# sourceMappingURL=logit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logit.js","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const $ = {};\nconst v = {\n debug: \"log\",\n success: \"log\"\n}, w = () => typeof window < \"u\" && $?.NODE_ENV ? !1 : typeof process < \"u\" && process.env?.NODE_ENV ? process.env.NODE_ENV === \"production\" : !1, _ = w(), L = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, b = {\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: L ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", 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}, l = {\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}, r = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, a = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), d = () => _ ? \"🄿\" : \"🄳\", x = (e, o) => {\n r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);\n}, g = (e) => v[e] || e, m = \"border: 1px solid\", p = \"border-radius: 4px\", h = \"border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter\", f = (e, o = \"\") => {\n const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${m} ${n}; ${p}`;\n switch (r.variant) {\n case \"symbol\":\n return `${s}; padding: 1px 1px 0${o}`;\n case \"icon\":\n return `${s}; padding: 0 3px${o}`;\n default:\n return `background: ${t}; color: ${c}; ${m} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;\n }\n}, E = (e) => {\n const o = b[e], { variant: t } = r;\n return t === \"text\" || !o[t] ? e.toUpperCase() : o[t];\n};\nfunction D(e) {\n const { namespace: o, timestamp: t, environment: c } = r;\n let n = `%c${E(e)}%c`;\n const s = [f(e), \"\"];\n return o && (n += ` %c${o}%c`, s.push(f(\"ns\", `; ${h}`), \"\")), c && (n += ` %c${d()}%c`, s.push(\"color: darkgray\", \"\")), t && (n += ` %c${u()}%c`, s.push(\"color: gray\", \"\")), { format: n, parts: s };\n}\nconst i = (e, ...o) => {\n if (typeof window > \"u\") {\n const s = console[g(e)];\n s(`${E(e)} | ${d()} |`, ...o);\n return;\n }\n if (!a(e)) return;\n const { format: t, parts: c } = D(e), n = console[g(e)];\n n(t, ...c, ...o), x(e, o);\n}, O = (e) => {\n const o = Math.floor(Date.now() - e);\n return o ? `${o}ms` : \"\";\n}, y = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (e, o, t) => console.assert(e, o, t),\n debug: (...e) => i(\"debug\", ...e),\n error: (...e) => i(\"error\", ...e),\n /**\n * Gets the current log level.\n */\n getLevel: () => r.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => r.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => r.timestamp,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (e, o = \"GROUP\", t = Date.now()) => {\n if (!a(\"success\")) return;\n const c = O(t), n = d(), s = r.timestamp ? u() : \"\";\n console.groupCollapsed(\n `%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,\n f(\"group\", \"; margin-right: 6px; padding: 1px 3px 0\"),\n f(\"ns\", `; ${h}; 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 * Ends the current console group.\n */\n groupEnd: () => {\n a(\"success\") && console.groupEnd();\n },\n info: (...e) => i(\"info\", ...e),\n /**\n * Initializes Logit with custom options.\n */\n initialise: (e) => {\n Object.assign(r, e);\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (e) => {\n r.logLevel = e;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (e) => {\n r.namespace = e;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (e) => {\n r.remote = e;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (e) => {\n r.remote.logLevel = e;\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (e) => {\n r.variant = e;\n },\n /**\n * Shows or hides the environment indicator.\n */\n showEnvironment: (e) => {\n r.environment = e;\n },\n /**\n * Shows or hides timestamps in logs.\n */\n showTimestamp: (e) => {\n r.timestamp = e;\n },\n success: (...e) => i(\"success\", ...e),\n /**\n * Displays data in a table format.\n */\n table: (...e) => {\n a(\"table\") && console.table(...e);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (e) => {\n a(\"time\") && console.time(e);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (e) => {\n a(\"time\") && console.timeEnd(e);\n },\n trace: (...e) => i(\"trace\", ...e),\n warn: (...e) => i(\"warn\", ...e)\n};\nexport {\n y as Logit\n};\n//# sourceMappingURL=logit.js.map\n"],"names":["$","w","_","a","d","x","g","m","h","E","i","y"],"mappings":"AAAA,MAAMA,IAAI,CAAA,GACJ,IAAI;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX,GAAGC,IAAI,MAAM,OAAO,SAAS,OAAOD,GAAG,WAAW,KAAK,OAAO,UAAU,OAAO,QAAQ,KAAK,WAAW,QAAQ,IAAI,aAAa,eAAe,IAAIE,IAAID,EAAC,GAAI,IAAI,OAAO,SAAS,OAAO,OAAO,aAAa,8BAA8B,EAAE,SAAS,IAAI;AAAA,EACtP,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,MAAM,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EAChF,IAAI,IAAI,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAM,IAAK,EAAE,IAAI,WAA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