@gesslar/toolkit 3.19.0 → 3.21.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/package.json +2 -2
- package/src/browser/lib/Promised.js +21 -11
- package/src/node/lib/FileObject.js +1 -2
- package/src/node/lib/Glog.js +355 -59
- package/types/browser/lib/Promised.d.ts +8 -8
- package/types/browser/lib/Promised.d.ts.map +1 -1
- package/types/node/lib/FileObject.d.ts.map +1 -1
- package/types/node/lib/Glog.d.ts +268 -64
- package/types/node/lib/Glog.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "gesslar",
|
|
6
6
|
"url": "https://gesslar.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "3.
|
|
8
|
+
"version": "3.21.0",
|
|
9
9
|
"license": "Unlicense",
|
|
10
10
|
"homepage": "https://github.com/gesslar/toolkit#readme",
|
|
11
11
|
"repository": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"yaml": "^2.8.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@gesslar/uglier": "^0.
|
|
61
|
+
"@gesslar/uglier": "^1.0.0",
|
|
62
62
|
"eslint": "^9.39.2",
|
|
63
63
|
"happy-dom": "^20.1.0",
|
|
64
64
|
"typescript": "^5.9.3"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Tantrum from "./Tantrum.js"
|
|
2
|
+
import Valid from "./Valid.js"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Utility class providing helper functions for working with Promises,
|
|
@@ -13,9 +14,24 @@ export default class Promised {
|
|
|
13
14
|
* @returns {Promise<Array<unknown>>} Results of all promises
|
|
14
15
|
*/
|
|
15
16
|
static async await(promises) {
|
|
17
|
+
Valid.type(promises, "Promise[]")
|
|
18
|
+
|
|
16
19
|
return await Promise.all(promises)
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Returns the first promise to resolve or reject from an array of promises.
|
|
24
|
+
* Wrapper around Promise.race for consistency with other utility methods.
|
|
25
|
+
*
|
|
26
|
+
* @param {Array<Promise<unknown>>} promises - Array of promises to race
|
|
27
|
+
* @returns {Promise<unknown>} Result of the first settled promise
|
|
28
|
+
*/
|
|
29
|
+
static async race(promises) {
|
|
30
|
+
Valid.type(promises, "Promise[]")
|
|
31
|
+
|
|
32
|
+
return await Promise.race(promises)
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
/**
|
|
20
36
|
* Settles all promises (both fulfilled and rejected) in parallel.
|
|
21
37
|
* Wrapper around Promise.allSettled for consistency with other utility methods.
|
|
@@ -24,6 +40,8 @@ export default class Promised {
|
|
|
24
40
|
* @returns {Promise<Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>>} Results of all settled promises with status and value/reason
|
|
25
41
|
*/
|
|
26
42
|
static async settle(promises) {
|
|
43
|
+
Valid.type(promises, "Promise[]")
|
|
44
|
+
|
|
27
45
|
return await Promise.allSettled(promises)
|
|
28
46
|
}
|
|
29
47
|
|
|
@@ -101,20 +119,12 @@ export default class Promised {
|
|
|
101
119
|
* @throws {Tantrum} Throws a Tantrum error with rejection reasons
|
|
102
120
|
*/
|
|
103
121
|
static throw(message="GIGO", settled) {
|
|
122
|
+
Valid.type(message, "String", {allowEmpty: false})
|
|
123
|
+
Valid.type(settled, "Array")
|
|
124
|
+
|
|
104
125
|
const rejected = this.rejected(settled)
|
|
105
126
|
const reasons = this.reasons(rejected)
|
|
106
127
|
|
|
107
128
|
throw Tantrum.new(message, reasons)
|
|
108
129
|
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Returns the first promise to resolve or reject from an array of promises.
|
|
112
|
-
* Wrapper around Promise.race for consistency with other utility methods.
|
|
113
|
-
*
|
|
114
|
-
* @param {Array<Promise<unknown>>} promises - Array of promises to race
|
|
115
|
-
* @returns {Promise<unknown>} Result of the first settled promise
|
|
116
|
-
*/
|
|
117
|
-
static async race(promises) {
|
|
118
|
-
return await Promise.race(promises)
|
|
119
|
-
}
|
|
120
130
|
}
|
|
@@ -458,9 +458,8 @@ export default class FileObject extends FS {
|
|
|
458
458
|
any: [JSON5,YAML]
|
|
459
459
|
}[normalizedType]
|
|
460
460
|
|
|
461
|
-
if(!toTry)
|
|
461
|
+
if(!toTry)
|
|
462
462
|
throw Sass.new(`Unsupported data type '${type}'. Supported types: json, json5, yaml.`)
|
|
463
|
-
}
|
|
464
463
|
|
|
465
464
|
for(const format of toTry) {
|
|
466
465
|
try {
|
package/src/node/lib/Glog.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 1. Simple function call: Glog(data)
|
|
8
8
|
* 2. With levels: Glog(2, "debug message")
|
|
9
9
|
* 3. Configured instance: new Glog(options)
|
|
10
|
-
* 4. Fluent setup: Glog.create().withName("App").
|
|
10
|
+
* 4. Fluent setup: Glog.create().withName("App").withColours()
|
|
11
11
|
* 5. Traditional logger: logger.debug("message", level)
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -16,9 +16,18 @@ import c from "@gesslar/colours"
|
|
|
16
16
|
import Data from "../../browser/lib/Data.js"
|
|
17
17
|
import Term from "./Term.js"
|
|
18
18
|
import Util from "../../browser/lib/Util.js"
|
|
19
|
-
// ErrorStackParser will be dynamically imported when needed
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Default colour configuration for logger output using @gesslar/colours format
|
|
22
|
+
*
|
|
23
|
+
* @type {object}
|
|
24
|
+
* @property {string[]} debug - Array of 5 colour codes for debug levels 0-4
|
|
25
|
+
* @property {string} info - Colour code for info messages
|
|
26
|
+
* @property {string} warn - Colour code for warning messages
|
|
27
|
+
* @property {string} error - Colour code for error messages
|
|
28
|
+
* @property {string} success - Colour code for success messages
|
|
29
|
+
* @property {string} reset - Colour reset code
|
|
30
|
+
*/
|
|
22
31
|
export const loggerColours = {
|
|
23
32
|
debug: [
|
|
24
33
|
"{F019}", // Debug level 0: Dark blue
|
|
@@ -34,7 +43,16 @@ export const loggerColours = {
|
|
|
34
43
|
reset: "{/}", // Reset
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Symbol characters used for log level tags when colours are disabled or tagsAsStrings is false
|
|
48
|
+
*
|
|
49
|
+
* @type {object}
|
|
50
|
+
* @property {string} debug - Symbol for debug messages
|
|
51
|
+
* @property {string} info - Symbol for info messages
|
|
52
|
+
* @property {string} warn - Symbol for warning messages
|
|
53
|
+
* @property {string} error - Symbol for error messages
|
|
54
|
+
* @property {string} success - Symbol for success messages
|
|
55
|
+
*/
|
|
38
56
|
export const logSymbols = {
|
|
39
57
|
debug: "?",
|
|
40
58
|
info: "i",
|
|
@@ -43,7 +61,7 @@ export const logSymbols = {
|
|
|
43
61
|
success: "✓"
|
|
44
62
|
}
|
|
45
63
|
|
|
46
|
-
// Set up convenient aliases for common log
|
|
64
|
+
// Set up convenient aliases for common log colours
|
|
47
65
|
c.alias.set("debug", "{F033}")
|
|
48
66
|
c.alias.set("info", "{F036}")
|
|
49
67
|
c.alias.set("warn", "{F214}")
|
|
@@ -57,23 +75,40 @@ class Glog {
|
|
|
57
75
|
// Static properties (for global usage)
|
|
58
76
|
static logLevel = 0
|
|
59
77
|
static logPrefix = ""
|
|
60
|
-
static
|
|
78
|
+
static colours = null
|
|
61
79
|
static stackTrace = false
|
|
62
80
|
static name = ""
|
|
63
81
|
static tagsAsStrings = false
|
|
82
|
+
static symbols = null
|
|
64
83
|
|
|
65
84
|
// Instance properties (for configured loggers)
|
|
66
85
|
#logLevel = 0
|
|
67
86
|
#logPrefix = ""
|
|
68
|
-
#
|
|
87
|
+
#colours = null
|
|
69
88
|
#stackTrace = false
|
|
70
89
|
#name = ""
|
|
71
90
|
#tagsAsStrings = false
|
|
72
91
|
#displayName = true
|
|
92
|
+
#symbols = null
|
|
73
93
|
#vscodeError = null
|
|
74
94
|
#vscodeWarn = null
|
|
75
95
|
#vscodeInfo = null
|
|
76
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Create a new Glog logger instance with optional configuration
|
|
99
|
+
*
|
|
100
|
+
* @param {object} [options={}] - Configuration options
|
|
101
|
+
* @param {string} [options.name] - Logger name to display in output
|
|
102
|
+
* @param {number} [options.debugLevel] - Debug verbosity level (0-5, default: 0)
|
|
103
|
+
* @param {number} [options.logLevel] - Alias for debugLevel
|
|
104
|
+
* @param {string} [options.prefix] - Prefix to prepend to all log messages
|
|
105
|
+
* @param {object} [options.colours] - Colour configuration object
|
|
106
|
+
* @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
107
|
+
* @param {boolean} [options.stackTrace=false] - Enable stack trace extraction
|
|
108
|
+
* @param {boolean} [options.tagsAsStrings=false] - Use string tags instead of symbols
|
|
109
|
+
* @param {boolean} [options.displayName=true] - Display logger name in output
|
|
110
|
+
* @param {string} [options.env] - Environment mode ("extension" for VSCode integration)
|
|
111
|
+
*/
|
|
77
112
|
constructor(options = {}) {
|
|
78
113
|
this.setOptions(options)
|
|
79
114
|
this.constructor.name = "Glog"
|
|
@@ -94,11 +129,27 @@ class Glog {
|
|
|
94
129
|
|
|
95
130
|
// === CONFIGURATION METHODS ===
|
|
96
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Set configuration options for this logger instance
|
|
134
|
+
*
|
|
135
|
+
* @param {object} options - Configuration options
|
|
136
|
+
* @param {string} [options.name] - Logger name to display in output
|
|
137
|
+
* @param {number} [options.debugLevel] - Debug verbosity level (0-5)
|
|
138
|
+
* @param {number} [options.logLevel] - Alias for debugLevel
|
|
139
|
+
* @param {string} [options.prefix] - Prefix to prepend to all log messages
|
|
140
|
+
* @param {object} [options.colours] - Colour configuration object
|
|
141
|
+
* @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
142
|
+
* @param {boolean} [options.stackTrace] - Enable stack trace extraction
|
|
143
|
+
* @param {boolean} [options.tagsAsStrings] - Use string tags instead of symbols
|
|
144
|
+
* @param {boolean} [options.displayName] - Display logger name in output
|
|
145
|
+
* @returns {Glog} This Glog instance for chaining
|
|
146
|
+
*/
|
|
97
147
|
setOptions(options) {
|
|
98
148
|
this.#name = options.name ?? this.#name
|
|
99
149
|
this.#logLevel = options.debugLevel ?? options.logLevel ?? this.#logLevel
|
|
100
150
|
this.#logPrefix = options.prefix ?? this.#logPrefix
|
|
101
|
-
this.#
|
|
151
|
+
this.#colours = options.colours ?? this.#colours
|
|
152
|
+
this.#symbols = options.symbols ?? this.#symbols
|
|
102
153
|
this.#stackTrace = options.stackTrace ?? this.#stackTrace
|
|
103
154
|
this.#tagsAsStrings = options.tagsAsStrings ?? this.#tagsAsStrings
|
|
104
155
|
this.#displayName = options.displayName ?? this.#displayName
|
|
@@ -145,18 +196,18 @@ class Glog {
|
|
|
145
196
|
}
|
|
146
197
|
|
|
147
198
|
/**
|
|
148
|
-
* Enable
|
|
149
|
-
* Merges with existing
|
|
199
|
+
* Enable colours for global usage
|
|
200
|
+
* Merges with existing colour configuration (can pass partial config)
|
|
150
201
|
* Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
|
|
151
|
-
* - debug: Array of 5
|
|
152
|
-
* - info, warn, error, reset: Single
|
|
202
|
+
* - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
|
|
203
|
+
* - info, warn, error, reset: Single colour code strings
|
|
153
204
|
* Uses @gesslar/colours format like "{F196}"
|
|
154
205
|
*
|
|
155
|
-
* @param {object} [
|
|
206
|
+
* @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
|
|
156
207
|
* @returns {typeof Glog} The Glog class for chaining
|
|
157
208
|
*/
|
|
158
|
-
static
|
|
159
|
-
this.
|
|
209
|
+
static withColours(colours = loggerColours) {
|
|
210
|
+
this.colours = Object.assign({}, this.colours ?? loggerColours, colours)
|
|
160
211
|
|
|
161
212
|
return this
|
|
162
213
|
}
|
|
@@ -185,6 +236,71 @@ class Glog {
|
|
|
185
236
|
return this
|
|
186
237
|
}
|
|
187
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Customize log level symbols for global usage
|
|
241
|
+
* Merges with existing symbols (can pass partial config)
|
|
242
|
+
* Only affects output when tagsAsStrings is false
|
|
243
|
+
* Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
|
|
244
|
+
*
|
|
245
|
+
* @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
|
|
246
|
+
* @returns {typeof Glog} The Glog class for chaining
|
|
247
|
+
* @example
|
|
248
|
+
* Glog.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
249
|
+
*/
|
|
250
|
+
static withSymbols(symbols = logSymbols) {
|
|
251
|
+
this.symbols = Object.assign({}, this.symbols ?? logSymbols, symbols)
|
|
252
|
+
|
|
253
|
+
return this
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Create a temporary scoped logger with a custom prefix for a single chain (static version)
|
|
258
|
+
* The prefix replaces all formatting (name, tags) with just the prefix + message
|
|
259
|
+
*
|
|
260
|
+
* @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
|
|
261
|
+
* @returns {object} Temporary logger with all standard methods
|
|
262
|
+
* @example
|
|
263
|
+
* Glog.use("=>").info("Indented message") // => Indented message
|
|
264
|
+
* Glog.info("Back to normal") // [Log] i Back to normal
|
|
265
|
+
*/
|
|
266
|
+
static use(prefix) {
|
|
267
|
+
return {
|
|
268
|
+
debug: (message, level = 1, ...args) => {
|
|
269
|
+
if(this.logLevel > 0 && level <= this.logLevel) {
|
|
270
|
+
Term.debug(`${prefix}${message}`, ...args)
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
info: (message, ...args) => Term.info(`${prefix}${message}`, ...args),
|
|
274
|
+
warn: (message, ...args) => Term.warn(`${prefix}${message}`, ...args),
|
|
275
|
+
error: (message, ...args) => Term.error(`${prefix}${message}`, ...args),
|
|
276
|
+
success: (message, ...args) => Term.log(`${prefix}${message}`, ...args),
|
|
277
|
+
log: (...args) => Term.log(prefix, ...args),
|
|
278
|
+
group: (...args) => {
|
|
279
|
+
const label = args.length > 0 ? ` ${args.join(" ")}` : ""
|
|
280
|
+
|
|
281
|
+
Term.group(`${prefix}${label}`)
|
|
282
|
+
},
|
|
283
|
+
groupEnd: () => Term.groupEnd(),
|
|
284
|
+
table: (data, labelOrOptions, options) => {
|
|
285
|
+
let label
|
|
286
|
+
let tableOptions = {}
|
|
287
|
+
|
|
288
|
+
if(typeof labelOrOptions === "string") {
|
|
289
|
+
label = labelOrOptions
|
|
290
|
+
tableOptions = options || {}
|
|
291
|
+
} else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
|
|
292
|
+
tableOptions = labelOrOptions
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if(label) {
|
|
296
|
+
Term.log(`${prefix}${label}`)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
Term.table(data, tableOptions)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
188
304
|
// === FLUENT INSTANCE CREATION ===
|
|
189
305
|
|
|
190
306
|
/**
|
|
@@ -197,18 +313,36 @@ class Glog {
|
|
|
197
313
|
return new this(options)
|
|
198
314
|
}
|
|
199
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Set the logger name for this instance
|
|
318
|
+
*
|
|
319
|
+
* @param {string} name - Logger name to display in output
|
|
320
|
+
* @returns {Glog} This Glog instance for chaining
|
|
321
|
+
*/
|
|
200
322
|
withName(name) {
|
|
201
323
|
this.#name = name
|
|
202
324
|
|
|
203
325
|
return this
|
|
204
326
|
}
|
|
205
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Set the log level for this instance (0-5)
|
|
330
|
+
*
|
|
331
|
+
* @param {number} level - Log level (0 = off, 1-5 = increasing verbosity)
|
|
332
|
+
* @returns {Glog} This Glog instance for chaining
|
|
333
|
+
*/
|
|
206
334
|
withLogLevel(level) {
|
|
207
335
|
this.#logLevel = level
|
|
208
336
|
|
|
209
337
|
return this
|
|
210
338
|
}
|
|
211
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Set the log prefix for this instance
|
|
342
|
+
*
|
|
343
|
+
* @param {string} prefix - Prefix to prepend to all log messages
|
|
344
|
+
* @returns {Glog} This Glog instance for chaining
|
|
345
|
+
*/
|
|
212
346
|
withPrefix(prefix) {
|
|
213
347
|
this.#logPrefix = prefix
|
|
214
348
|
|
|
@@ -216,93 +350,209 @@ class Glog {
|
|
|
216
350
|
}
|
|
217
351
|
|
|
218
352
|
/**
|
|
219
|
-
* Enable
|
|
220
|
-
* Merges with existing
|
|
353
|
+
* Enable colours for this logger instance
|
|
354
|
+
* Merges with existing colour configuration (can pass partial config)
|
|
221
355
|
* Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
|
|
222
|
-
* - debug: Array of 5
|
|
223
|
-
* - info, warn, error, reset: Single
|
|
356
|
+
* - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
|
|
357
|
+
* - info, warn, error, reset: Single colour code strings
|
|
224
358
|
* Uses @gesslar/colours format like "{F196}"
|
|
225
359
|
*
|
|
226
|
-
* @param {object} [
|
|
360
|
+
* @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
|
|
227
361
|
* @returns {Glog} This Glog instance for chaining
|
|
228
362
|
*/
|
|
229
|
-
|
|
230
|
-
this.#
|
|
363
|
+
withColours(colours = loggerColours) {
|
|
364
|
+
this.#colours = Object.assign({}, this.#colours ?? loggerColours, colours)
|
|
231
365
|
|
|
232
366
|
return this
|
|
233
367
|
}
|
|
234
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Enable or disable stack trace extraction for this instance
|
|
371
|
+
*
|
|
372
|
+
* @param {boolean} [enabled=true] - Whether to enable stack traces
|
|
373
|
+
* @returns {Glog} This Glog instance for chaining
|
|
374
|
+
*/
|
|
235
375
|
withStackTrace(enabled = true) {
|
|
236
376
|
this.#stackTrace = enabled
|
|
237
377
|
|
|
238
378
|
return this
|
|
239
379
|
}
|
|
240
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Use tag names as strings instead of symbols for this instance
|
|
383
|
+
*
|
|
384
|
+
* @param {boolean} [enabled=false] - Whether to use string tags
|
|
385
|
+
* @returns {Glog} This Glog instance for chaining
|
|
386
|
+
*/
|
|
241
387
|
withTagsAsStrings(enabled = false) {
|
|
242
388
|
this.#tagsAsStrings = enabled
|
|
243
389
|
|
|
244
390
|
return this
|
|
245
391
|
}
|
|
246
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Customize log level symbols for this logger instance
|
|
395
|
+
* Merges with existing symbols (can pass partial config)
|
|
396
|
+
* Only affects output when tagsAsStrings is false
|
|
397
|
+
* Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
|
|
398
|
+
*
|
|
399
|
+
* @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
|
|
400
|
+
* @returns {Glog} This Glog instance for chaining
|
|
401
|
+
* @example
|
|
402
|
+
* logger.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
403
|
+
*/
|
|
404
|
+
withSymbols(symbols = logSymbols) {
|
|
405
|
+
this.#symbols = Object.assign({}, this.#symbols ?? logSymbols, symbols)
|
|
406
|
+
|
|
407
|
+
return this
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Disable displaying the logger name in output for this instance
|
|
412
|
+
*
|
|
413
|
+
* @returns {Glog} This Glog instance for chaining
|
|
414
|
+
*/
|
|
247
415
|
noDisplayName() {
|
|
248
416
|
this.#displayName = false
|
|
249
417
|
|
|
250
418
|
return this
|
|
251
419
|
}
|
|
252
420
|
|
|
421
|
+
/**
|
|
422
|
+
* Create a temporary scoped logger with a custom prefix for a single chain
|
|
423
|
+
* The prefix replaces all formatting (name, tags) with just the prefix + message
|
|
424
|
+
*
|
|
425
|
+
* @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
|
|
426
|
+
* @returns {object} Temporary logger with all standard methods
|
|
427
|
+
* @example
|
|
428
|
+
* logger.use("=>").info("Indented message") // => Indented message
|
|
429
|
+
* logger.info("Back to normal") // [MyApp] i Back to normal
|
|
430
|
+
*/
|
|
431
|
+
use(prefix) {
|
|
432
|
+
return {
|
|
433
|
+
debug: (message, level = 1, ...args) => {
|
|
434
|
+
const currentLevel = this.#logLevel || Glog.logLevel
|
|
435
|
+
|
|
436
|
+
if(currentLevel > 0 && level <= currentLevel) {
|
|
437
|
+
Term.debug(`${prefix}${message}`, ...args)
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
info: (message, ...args) => Term.info(`${prefix}${message}`, ...args),
|
|
441
|
+
warn: (message, ...args) => Term.warn(`${prefix}${message}`, ...args),
|
|
442
|
+
error: (message, ...args) => Term.error(`${prefix}${message}`, ...args),
|
|
443
|
+
success: (message, ...args) => Term.log(`${prefix}${message}`, ...args),
|
|
444
|
+
log: (...args) => Term.log(prefix, ...args),
|
|
445
|
+
group: (...args) => {
|
|
446
|
+
const label = args.length > 0 ? ` ${args.join(" ")}` : ""
|
|
447
|
+
|
|
448
|
+
Term.group(`${prefix}${label}`)
|
|
449
|
+
},
|
|
450
|
+
groupEnd: () => Term.groupEnd(),
|
|
451
|
+
table: (data, labelOrOptions, options) => {
|
|
452
|
+
let label
|
|
453
|
+
let tableOptions = {}
|
|
454
|
+
|
|
455
|
+
if(typeof labelOrOptions === "string") {
|
|
456
|
+
label = labelOrOptions
|
|
457
|
+
tableOptions = options || {}
|
|
458
|
+
} else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
|
|
459
|
+
tableOptions = labelOrOptions
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if(label) {
|
|
463
|
+
Term.log(`${prefix}${label}`)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
Term.table(data, tableOptions)
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
253
471
|
// === UTILITY METHODS ===
|
|
254
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Get the current logger name
|
|
475
|
+
*
|
|
476
|
+
* @returns {string} The logger name
|
|
477
|
+
*/
|
|
255
478
|
get name() {
|
|
256
479
|
return this.#name
|
|
257
480
|
}
|
|
258
481
|
|
|
482
|
+
/**
|
|
483
|
+
* Get the current debug level
|
|
484
|
+
*
|
|
485
|
+
* @returns {number} The debug level (0-5)
|
|
486
|
+
*/
|
|
259
487
|
get debugLevel() {
|
|
260
488
|
return this.#logLevel
|
|
261
489
|
}
|
|
262
490
|
|
|
491
|
+
/**
|
|
492
|
+
* Get the current logger options configuration
|
|
493
|
+
*
|
|
494
|
+
* @returns {object} The logger options
|
|
495
|
+
* @returns {string} return.name - Logger name
|
|
496
|
+
* @returns {number} return.debugLevel - Debug level
|
|
497
|
+
* @returns {string} return.prefix - Log prefix
|
|
498
|
+
* @returns {object} return.colours - Colour configuration
|
|
499
|
+
* @returns {boolean} return.stackTrace - Stack trace enabled
|
|
500
|
+
*/
|
|
263
501
|
get options() {
|
|
264
502
|
return {
|
|
265
503
|
name: this.#name,
|
|
266
504
|
debugLevel: this.#logLevel,
|
|
267
505
|
prefix: this.#logPrefix,
|
|
268
|
-
|
|
506
|
+
colours: this.#colours,
|
|
269
507
|
stackTrace: this.#stackTrace
|
|
270
508
|
}
|
|
271
509
|
}
|
|
272
510
|
|
|
273
511
|
#compose(level, message, debugLevel = 0) {
|
|
274
|
-
const
|
|
512
|
+
const colours = this.#colours || Glog.colours || loggerColours
|
|
275
513
|
const name = this.#name || Glog.name || "Log"
|
|
276
514
|
const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
|
|
277
515
|
const showName = this.#displayName
|
|
278
|
-
const
|
|
516
|
+
const symbols = this.#symbols || Glog.symbols || logSymbols
|
|
517
|
+
const tag = useStrings ? Util.capitalize(level) : symbols[level]
|
|
279
518
|
const namePrefix = showName ? `[${name}] ` : ""
|
|
280
519
|
|
|
281
|
-
if(!
|
|
520
|
+
if(!colours) {
|
|
282
521
|
return useStrings
|
|
283
522
|
? `${namePrefix}${tag}: ${message}`
|
|
284
523
|
: `${namePrefix}${tag} ${message}`
|
|
285
524
|
}
|
|
286
525
|
|
|
287
526
|
if(level === "debug") {
|
|
288
|
-
const
|
|
527
|
+
const colourCode = colours[level][debugLevel] || colours[level][0]
|
|
289
528
|
|
|
290
529
|
return useStrings
|
|
291
|
-
? c`${namePrefix}${
|
|
292
|
-
: c`${namePrefix}${
|
|
530
|
+
? c`${namePrefix}${colourCode}${tag}{/}: ${message}`
|
|
531
|
+
: c`${namePrefix}${colourCode}${tag}{/} ${message}`
|
|
293
532
|
}
|
|
294
533
|
|
|
295
534
|
return useStrings
|
|
296
|
-
? c`${namePrefix}${
|
|
297
|
-
: c`${namePrefix}${
|
|
535
|
+
? c`${namePrefix}${colours[level]}${tag}{/}: ${message}`
|
|
536
|
+
: c`${namePrefix}${colours[level]}${tag}{/} ${message}`
|
|
298
537
|
}
|
|
299
538
|
|
|
300
|
-
|
|
539
|
+
/**
|
|
540
|
+
* Extract file and function information from stack trace
|
|
541
|
+
*
|
|
542
|
+
* @private
|
|
543
|
+
* @returns {string} Caller tag
|
|
544
|
+
*/
|
|
301
545
|
extractFileFunction() {
|
|
302
546
|
// Simple fallback - just return a basic tag
|
|
303
547
|
return "caller"
|
|
304
548
|
}
|
|
305
549
|
|
|
550
|
+
/**
|
|
551
|
+
* Create a new debug function with a specific tag
|
|
552
|
+
*
|
|
553
|
+
* @param {string} tag - Tag to prepend to debug messages
|
|
554
|
+
* @returns {Function} Debug function with the tag
|
|
555
|
+
*/
|
|
306
556
|
newDebug(tag) {
|
|
307
557
|
return function(message, level, ...arg) {
|
|
308
558
|
if(this.#stackTrace || Glog.stackTrace) {
|
|
@@ -363,16 +613,34 @@ class Glog {
|
|
|
363
613
|
}
|
|
364
614
|
}
|
|
365
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Log an informational message
|
|
618
|
+
*
|
|
619
|
+
* @param {string} message - Info message to log
|
|
620
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
621
|
+
*/
|
|
366
622
|
info(message, ...arg) {
|
|
367
623
|
Term.info(this.#compose("info", message), ...arg)
|
|
368
624
|
this.#vscodeInfo?.(JSON.stringify(message))
|
|
369
625
|
}
|
|
370
626
|
|
|
627
|
+
/**
|
|
628
|
+
* Log a warning message
|
|
629
|
+
*
|
|
630
|
+
* @param {string} message - Warning message to log
|
|
631
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
632
|
+
*/
|
|
371
633
|
warn(message, ...arg) {
|
|
372
634
|
Term.warn(this.#compose("warn", message), ...arg)
|
|
373
635
|
this.#vscodeWarn?.(JSON.stringify(message))
|
|
374
636
|
}
|
|
375
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Log an error message
|
|
640
|
+
*
|
|
641
|
+
* @param {string} message - Error message to log
|
|
642
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
643
|
+
*/
|
|
376
644
|
error(message, ...arg) {
|
|
377
645
|
Term.error(this.#compose("error", message), ...arg)
|
|
378
646
|
this.#vscodeError?.(JSON.stringify(message))
|
|
@@ -406,7 +674,12 @@ class Glog {
|
|
|
406
674
|
}
|
|
407
675
|
}
|
|
408
676
|
|
|
409
|
-
|
|
677
|
+
/**
|
|
678
|
+
* Instance execute method for configured loggers
|
|
679
|
+
* Can be called as: logger(data) or logger(level, data)
|
|
680
|
+
*
|
|
681
|
+
* @param {...unknown} args - Arguments (optional level number, then data)
|
|
682
|
+
*/
|
|
410
683
|
execute(...args) {
|
|
411
684
|
this.#log(...args)
|
|
412
685
|
}
|
|
@@ -414,13 +687,13 @@ class Glog {
|
|
|
414
687
|
// === ENHANCED METHODS WITH @gesslar/colours ===
|
|
415
688
|
|
|
416
689
|
/**
|
|
417
|
-
* Log a
|
|
690
|
+
* Log a colourized message using template literals
|
|
418
691
|
*
|
|
419
692
|
* @param {Array<string>} strings - Template strings
|
|
420
693
|
* @param {...unknown} values - Template values
|
|
421
|
-
* @example logger.
|
|
694
|
+
* @example logger.colourize`{success}Operation completed{/} in {bold}${time}ms{/}`
|
|
422
695
|
*/
|
|
423
|
-
|
|
696
|
+
colourize(strings, ...values) {
|
|
424
697
|
const message = c(strings, ...values)
|
|
425
698
|
const name = this.#name || Glog.name || "Log"
|
|
426
699
|
|
|
@@ -428,12 +701,12 @@ class Glog {
|
|
|
428
701
|
}
|
|
429
702
|
|
|
430
703
|
/**
|
|
431
|
-
* Static version of
|
|
704
|
+
* Static version of colourize for global usage
|
|
432
705
|
*
|
|
433
706
|
* @param {Array<string>} strings - Template strings
|
|
434
707
|
* @param {...unknown} values - Template values
|
|
435
708
|
*/
|
|
436
|
-
static
|
|
709
|
+
static colourize(strings, ...values) {
|
|
437
710
|
const message = c(strings, ...values)
|
|
438
711
|
const name = this.name || "Log"
|
|
439
712
|
|
|
@@ -441,7 +714,7 @@ class Glog {
|
|
|
441
714
|
}
|
|
442
715
|
|
|
443
716
|
/**
|
|
444
|
-
* Log a success message with green
|
|
717
|
+
* Log a success message with green colour
|
|
445
718
|
*
|
|
446
719
|
* @param {string} message - Success message
|
|
447
720
|
* @param {...unknown} args - Additional arguments
|
|
@@ -457,14 +730,15 @@ class Glog {
|
|
|
457
730
|
* @param {...unknown} args - Additional arguments to log
|
|
458
731
|
*/
|
|
459
732
|
static success(message, ...args) {
|
|
460
|
-
const
|
|
733
|
+
const colours = this.colours || loggerColours
|
|
461
734
|
const name = this.name || "Log"
|
|
462
735
|
const useStrings = this.tagsAsStrings
|
|
463
|
-
const
|
|
464
|
-
const
|
|
736
|
+
const symbols = this.symbols || logSymbols
|
|
737
|
+
const tag = useStrings ? "Success" : symbols.success
|
|
738
|
+
const colourCode = colours.success || "{F046}"
|
|
465
739
|
const formatted = useStrings
|
|
466
|
-
? c`[${name}] ${
|
|
467
|
-
: c`[${name}] ${
|
|
740
|
+
? c`[${name}] ${colourCode}${tag}{/}: ${message}`
|
|
741
|
+
: c`[${name}] ${colourCode}${tag}{/} ${message}`
|
|
468
742
|
|
|
469
743
|
Term.log(formatted, ...args)
|
|
470
744
|
}
|
|
@@ -495,14 +769,15 @@ class Glog {
|
|
|
495
769
|
* @param {number} [level=1] - Debug level
|
|
496
770
|
*/
|
|
497
771
|
static groupDebug(message, level = 1) {
|
|
498
|
-
const
|
|
772
|
+
const colours = this.colours || loggerColours
|
|
499
773
|
const name = this.name || "Log"
|
|
500
774
|
const useStrings = this.tagsAsStrings
|
|
501
|
-
const
|
|
502
|
-
const
|
|
775
|
+
const symbols = this.symbols || logSymbols
|
|
776
|
+
const tag = useStrings ? "Debug" : symbols.debug
|
|
777
|
+
const colourCode = colours.debug[level] || colours.debug[0]
|
|
503
778
|
const label = useStrings
|
|
504
|
-
? c`[${name}] ${
|
|
505
|
-
: c`[${name}] ${
|
|
779
|
+
? c`[${name}] ${colourCode}${tag}{/}: ${message}`
|
|
780
|
+
: c`[${name}] ${colourCode}${tag}{/} ${message}`
|
|
506
781
|
|
|
507
782
|
Term.group(label)
|
|
508
783
|
}
|
|
@@ -513,13 +788,14 @@ class Glog {
|
|
|
513
788
|
* @param {string} message - Group label
|
|
514
789
|
*/
|
|
515
790
|
static groupInfo(message) {
|
|
516
|
-
const
|
|
791
|
+
const colours = this.colours || loggerColours
|
|
517
792
|
const name = this.name || "Log"
|
|
518
793
|
const useStrings = this.tagsAsStrings
|
|
519
|
-
const
|
|
794
|
+
const symbols = this.symbols || logSymbols
|
|
795
|
+
const tag = useStrings ? "Info" : symbols.info
|
|
520
796
|
const label = useStrings
|
|
521
|
-
? c`[${name}] ${
|
|
522
|
-
: c`[${name}] ${
|
|
797
|
+
? c`[${name}] ${colours.info}${tag}{/}: ${message}`
|
|
798
|
+
: c`[${name}] ${colours.info}${tag}{/} ${message}`
|
|
523
799
|
|
|
524
800
|
Term.group(label)
|
|
525
801
|
}
|
|
@@ -532,7 +808,8 @@ class Glog {
|
|
|
532
808
|
static groupSuccess(message) {
|
|
533
809
|
const name = this.name || "Log"
|
|
534
810
|
const useStrings = this.tagsAsStrings
|
|
535
|
-
const
|
|
811
|
+
const symbols = this.symbols || logSymbols
|
|
812
|
+
const tag = useStrings ? "Success" : symbols.success
|
|
536
813
|
const label = useStrings
|
|
537
814
|
? c`[${name}] {success}${tag}{/}: ${message}`
|
|
538
815
|
: c`[${name}] {success}${tag}{/} ${message}`
|
|
@@ -589,7 +866,8 @@ class Glog {
|
|
|
589
866
|
const name = this.#name || Glog.name || "Log"
|
|
590
867
|
const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
|
|
591
868
|
const showName = this.#displayName
|
|
592
|
-
const
|
|
869
|
+
const symbols = this.#symbols || Glog.symbols || logSymbols
|
|
870
|
+
const tag = useStrings ? "Success" : symbols.success
|
|
593
871
|
const namePrefix = showName ? `[${name}] ` : ""
|
|
594
872
|
const label = useStrings
|
|
595
873
|
? c`${namePrefix}{success}${tag}{/}: ${message}`
|
|
@@ -657,14 +935,14 @@ class Glog {
|
|
|
657
935
|
}
|
|
658
936
|
|
|
659
937
|
/**
|
|
660
|
-
* Set a
|
|
938
|
+
* Set a colour alias for convenient usage
|
|
661
939
|
*
|
|
662
940
|
* @param {string} alias - Alias name
|
|
663
|
-
* @param {string}
|
|
941
|
+
* @param {string} colourCode - Colour code (e.g., "{F196}" or "{<B}")
|
|
664
942
|
* @returns {Glog} The Glog class for chaining.
|
|
665
943
|
*/
|
|
666
|
-
static setAlias(alias,
|
|
667
|
-
c.alias.set(alias,
|
|
944
|
+
static setAlias(alias, colourCode) {
|
|
945
|
+
c.alias.set(alias, colourCode)
|
|
668
946
|
|
|
669
947
|
return this
|
|
670
948
|
}
|
|
@@ -682,6 +960,15 @@ class Glog {
|
|
|
682
960
|
* Get a raw logger that outputs without name/tag formatting
|
|
683
961
|
*
|
|
684
962
|
* @returns {object} Raw logger interface
|
|
963
|
+
* @returns {Function} return.debug - Raw debug output function
|
|
964
|
+
* @returns {Function} return.info - Raw info output function
|
|
965
|
+
* @returns {Function} return.warn - Raw warning output function
|
|
966
|
+
* @returns {Function} return.error - Raw error output function
|
|
967
|
+
* @returns {Function} return.log - Raw log output function
|
|
968
|
+
* @returns {Function} return.success - Raw success output function
|
|
969
|
+
* @returns {Function} return.table - Raw table output function
|
|
970
|
+
* @returns {Function} return.group - Raw group start function
|
|
971
|
+
* @returns {Function} return.groupEnd - Raw group end function
|
|
685
972
|
*/
|
|
686
973
|
get raw() {
|
|
687
974
|
return {
|
|
@@ -701,6 +988,15 @@ class Glog {
|
|
|
701
988
|
* Static raw logger that outputs without name/tag formatting
|
|
702
989
|
*
|
|
703
990
|
* @returns {object} Raw logger interface
|
|
991
|
+
* @returns {Function} return.debug - Raw debug output function
|
|
992
|
+
* @returns {Function} return.info - Raw info output function
|
|
993
|
+
* @returns {Function} return.warn - Raw warning output function
|
|
994
|
+
* @returns {Function} return.error - Raw error output function
|
|
995
|
+
* @returns {Function} return.log - Raw log output function
|
|
996
|
+
* @returns {Function} return.success - Raw success output function
|
|
997
|
+
* @returns {Function} return.table - Raw table output function
|
|
998
|
+
* @returns {Function} return.group - Raw group start function
|
|
999
|
+
* @returns {Function} return.groupEnd - Raw group end function
|
|
704
1000
|
*/
|
|
705
1001
|
static get raw() {
|
|
706
1002
|
return {
|
|
@@ -11,6 +11,14 @@ export default class Promised {
|
|
|
11
11
|
* @returns {Promise<Array<unknown>>} Results of all promises
|
|
12
12
|
*/
|
|
13
13
|
static await(promises: Array<Promise<unknown>>): Promise<Array<unknown>>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the first promise to resolve or reject from an array of promises.
|
|
16
|
+
* Wrapper around Promise.race for consistency with other utility methods.
|
|
17
|
+
*
|
|
18
|
+
* @param {Array<Promise<unknown>>} promises - Array of promises to race
|
|
19
|
+
* @returns {Promise<unknown>} Result of the first settled promise
|
|
20
|
+
*/
|
|
21
|
+
static race(promises: Array<Promise<unknown>>): Promise<unknown>;
|
|
14
22
|
/**
|
|
15
23
|
* Settles all promises (both fulfilled and rejected) in parallel.
|
|
16
24
|
* Wrapper around Promise.allSettled for consistency with other utility methods.
|
|
@@ -107,13 +115,5 @@ export default class Promised {
|
|
|
107
115
|
value?: unknown;
|
|
108
116
|
reason?: unknown;
|
|
109
117
|
}>): void;
|
|
110
|
-
/**
|
|
111
|
-
* Returns the first promise to resolve or reject from an array of promises.
|
|
112
|
-
* Wrapper around Promise.race for consistency with other utility methods.
|
|
113
|
-
*
|
|
114
|
-
* @param {Array<Promise<unknown>>} promises - Array of promises to race
|
|
115
|
-
* @returns {Promise<unknown>} Result of the first settled promise
|
|
116
|
-
*/
|
|
117
|
-
static race(promises: Array<Promise<unknown>>): Promise<unknown>;
|
|
118
118
|
}
|
|
119
119
|
//# sourceMappingURL=Promised.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Promised.d.ts","sourceRoot":"","sources":["../../../src/browser/lib/Promised.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Promised.d.ts","sourceRoot":"","sources":["../../../src/browser/lib/Promised.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAMnC;IAED;;;;;;OAMG;IACH,sBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,OAAO,CAAC,CAM5B;IAED;;;;;;OAMG;IACH,wBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,CAAC,CAM/F;IAED;;;;;OAKG;IACH,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AKG;IACH,YAFa,OAAO,CAAC,IAAI,OAAC,CAAC,CAU1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAS3B;IAED;;;;;;;;;;;OAWG;IACH,cARa,OAAO,CAAC,MAAM,CAAC,CAe3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAwBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileObject.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AAEH;IACE;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,IAAI,CAAC,CAAA;KAAC,CAO1D;IA0BF;;;;;;;;OAQG;IACH,gDAOC;IAED;;;;;OAKG;IACH,uBAHW,MAAM,WACN,eAAe,GAAC,MAAM,GAAC,IAAI,EA6DrC;IAaD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,GAAG,CAIf;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAFa,MAAM,CAIlB;IACD;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;;;;;;;;;;OAcG;IACH,cAFa,eAAe,CAI3B;IAED;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,OAAO,CAAC,OAAO,CAAC,CAU5B;IAED;;;;OAIG;IACH,YAFa,OAAO,CAAC,OAAO,CAAC,CAU5B;IAiBD;;;;OAIG;IACH,QAFa,OAAO,CAAC,MAAM,OAAC,CAAC,CAU5B;IAED;;;;;OAKG;IACH,YAFa,OAAO,CAAC,IAAI,OAAC,CAAC,CAU1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAS3B;IAED;;;;;;;;;;;OAWG;IACH,cARa,OAAO,CAAC,MAAM,CAAC,CAe3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAwBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAiC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAS3B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAczB;;CACF;eA9ec,iBAAiB;4BADJ,sBAAsB"}
|
package/types/node/lib/Glog.d.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Default colour configuration for logger output using @gesslar/colours format
|
|
3
|
+
*
|
|
4
|
+
* @type {object}
|
|
5
|
+
* @property {string[]} debug - Array of 5 colour codes for debug levels 0-4
|
|
6
|
+
* @property {string} info - Colour code for info messages
|
|
7
|
+
* @property {string} warn - Colour code for warning messages
|
|
8
|
+
* @property {string} error - Colour code for error messages
|
|
9
|
+
* @property {string} success - Colour code for success messages
|
|
10
|
+
* @property {string} reset - Colour reset code
|
|
11
|
+
*/
|
|
12
|
+
export const loggerColours: object;
|
|
13
|
+
/**
|
|
14
|
+
* Symbol characters used for log level tags when colours are disabled or tagsAsStrings is false
|
|
15
|
+
*
|
|
16
|
+
* @type {object}
|
|
17
|
+
* @property {string} debug - Symbol for debug messages
|
|
18
|
+
* @property {string} info - Symbol for info messages
|
|
19
|
+
* @property {string} warn - Symbol for warning messages
|
|
20
|
+
* @property {string} error - Symbol for error messages
|
|
21
|
+
* @property {string} success - Symbol for success messages
|
|
22
|
+
*/
|
|
23
|
+
export const logSymbols: object;
|
|
21
24
|
declare const _default: typeof Glog;
|
|
22
25
|
export default _default;
|
|
23
26
|
declare class Glog {
|
|
24
27
|
static logLevel: number;
|
|
25
28
|
static logPrefix: string;
|
|
26
|
-
static
|
|
29
|
+
static colours: any;
|
|
27
30
|
static stackTrace: boolean;
|
|
28
31
|
static name: string;
|
|
29
32
|
static tagsAsStrings: boolean;
|
|
33
|
+
static symbols: any;
|
|
30
34
|
/**
|
|
31
35
|
* Set the log prefix for global usage
|
|
32
36
|
*
|
|
@@ -49,17 +53,17 @@ declare class Glog {
|
|
|
49
53
|
*/
|
|
50
54
|
static withName(name: string): typeof Glog;
|
|
51
55
|
/**
|
|
52
|
-
* Enable
|
|
53
|
-
* Merges with existing
|
|
56
|
+
* Enable colours for global usage
|
|
57
|
+
* Merges with existing colour configuration (can pass partial config)
|
|
54
58
|
* Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
|
|
55
|
-
* - debug: Array of 5
|
|
56
|
-
* - info, warn, error, reset: Single
|
|
59
|
+
* - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
|
|
60
|
+
* - info, warn, error, reset: Single colour code strings
|
|
57
61
|
* Uses @gesslar/colours format like "{F196}"
|
|
58
62
|
*
|
|
59
|
-
* @param {object} [
|
|
63
|
+
* @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
|
|
60
64
|
* @returns {typeof Glog} The Glog class for chaining
|
|
61
65
|
*/
|
|
62
|
-
static
|
|
66
|
+
static withColours(colours?: object): typeof Glog;
|
|
63
67
|
/**
|
|
64
68
|
* Enable stack trace extraction for global usage
|
|
65
69
|
*
|
|
@@ -74,6 +78,29 @@ declare class Glog {
|
|
|
74
78
|
* @returns {typeof Glog} The Glog class for chaining
|
|
75
79
|
*/
|
|
76
80
|
static withTagsAsStrings(enabled?: boolean): typeof Glog;
|
|
81
|
+
/**
|
|
82
|
+
* Customize log level symbols for global usage
|
|
83
|
+
* Merges with existing symbols (can pass partial config)
|
|
84
|
+
* Only affects output when tagsAsStrings is false
|
|
85
|
+
* Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
|
|
86
|
+
*
|
|
87
|
+
* @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
|
|
88
|
+
* @returns {typeof Glog} The Glog class for chaining
|
|
89
|
+
* @example
|
|
90
|
+
* Glog.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
91
|
+
*/
|
|
92
|
+
static withSymbols(symbols?: object): typeof Glog;
|
|
93
|
+
/**
|
|
94
|
+
* Create a temporary scoped logger with a custom prefix for a single chain (static version)
|
|
95
|
+
* The prefix replaces all formatting (name, tags) with just the prefix + message
|
|
96
|
+
*
|
|
97
|
+
* @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
|
|
98
|
+
* @returns {object} Temporary logger with all standard methods
|
|
99
|
+
* @example
|
|
100
|
+
* Glog.use("=>").info("Indented message") // => Indented message
|
|
101
|
+
* Glog.info("Back to normal") // [Log] i Back to normal
|
|
102
|
+
*/
|
|
103
|
+
static use(prefix: string): object;
|
|
77
104
|
/**
|
|
78
105
|
* Create a new Glog instance with fluent configuration
|
|
79
106
|
*
|
|
@@ -89,12 +116,12 @@ declare class Glog {
|
|
|
89
116
|
*/
|
|
90
117
|
static execute(...args: unknown[]): void;
|
|
91
118
|
/**
|
|
92
|
-
* Static version of
|
|
119
|
+
* Static version of colourize for global usage
|
|
93
120
|
*
|
|
94
121
|
* @param {Array<string>} strings - Template strings
|
|
95
122
|
* @param {...unknown} values - Template values
|
|
96
123
|
*/
|
|
97
|
-
static
|
|
124
|
+
static colourize(strings: Array<string>, ...values: unknown[]): void;
|
|
98
125
|
/**
|
|
99
126
|
* Static success method
|
|
100
127
|
*
|
|
@@ -147,50 +174,194 @@ declare class Glog {
|
|
|
147
174
|
quotedStrings?: boolean;
|
|
148
175
|
}): void;
|
|
149
176
|
/**
|
|
150
|
-
* Set a
|
|
177
|
+
* Set a colour alias for convenient usage
|
|
151
178
|
*
|
|
152
179
|
* @param {string} alias - Alias name
|
|
153
|
-
* @param {string}
|
|
180
|
+
* @param {string} colourCode - Colour code (e.g., "{F196}" or "{<B}")
|
|
154
181
|
* @returns {Glog} The Glog class for chaining.
|
|
155
182
|
*/
|
|
156
|
-
static setAlias(alias: string,
|
|
183
|
+
static setAlias(alias: string, colourCode: string): Glog;
|
|
157
184
|
/**
|
|
158
185
|
* Static raw logger that outputs without name/tag formatting
|
|
159
186
|
*
|
|
160
187
|
* @returns {object} Raw logger interface
|
|
188
|
+
* @returns {Function} return.debug - Raw debug output function
|
|
189
|
+
* @returns {Function} return.info - Raw info output function
|
|
190
|
+
* @returns {Function} return.warn - Raw warning output function
|
|
191
|
+
* @returns {Function} return.error - Raw error output function
|
|
192
|
+
* @returns {Function} return.log - Raw log output function
|
|
193
|
+
* @returns {Function} return.success - Raw success output function
|
|
194
|
+
* @returns {Function} return.table - Raw table output function
|
|
195
|
+
* @returns {Function} return.group - Raw group start function
|
|
196
|
+
* @returns {Function} return.groupEnd - Raw group end function
|
|
161
197
|
*/
|
|
162
198
|
static get raw(): object;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
*
|
|
199
|
+
/**
|
|
200
|
+
* Create a new Glog logger instance with optional configuration
|
|
201
|
+
*
|
|
202
|
+
* @param {object} [options={}] - Configuration options
|
|
203
|
+
* @param {string} [options.name] - Logger name to display in output
|
|
204
|
+
* @param {number} [options.debugLevel] - Debug verbosity level (0-5, default: 0)
|
|
205
|
+
* @param {number} [options.logLevel] - Alias for debugLevel
|
|
206
|
+
* @param {string} [options.prefix] - Prefix to prepend to all log messages
|
|
207
|
+
* @param {object} [options.colours] - Colour configuration object
|
|
208
|
+
* @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
209
|
+
* @param {boolean} [options.stackTrace=false] - Enable stack trace extraction
|
|
210
|
+
* @param {boolean} [options.tagsAsStrings=false] - Use string tags instead of symbols
|
|
211
|
+
* @param {boolean} [options.displayName=true] - Display logger name in output
|
|
212
|
+
* @param {string} [options.env] - Environment mode ("extension" for VSCode integration)
|
|
213
|
+
*/
|
|
214
|
+
constructor(options?: {
|
|
215
|
+
name?: string;
|
|
216
|
+
debugLevel?: number;
|
|
217
|
+
logLevel?: number;
|
|
218
|
+
prefix?: string;
|
|
219
|
+
colours?: object;
|
|
220
|
+
symbols?: object;
|
|
221
|
+
stackTrace?: boolean;
|
|
222
|
+
tagsAsStrings?: boolean;
|
|
223
|
+
displayName?: boolean;
|
|
224
|
+
env?: string;
|
|
225
|
+
});
|
|
226
|
+
/**
|
|
227
|
+
* Set configuration options for this logger instance
|
|
228
|
+
*
|
|
229
|
+
* @param {object} options - Configuration options
|
|
230
|
+
* @param {string} [options.name] - Logger name to display in output
|
|
231
|
+
* @param {number} [options.debugLevel] - Debug verbosity level (0-5)
|
|
232
|
+
* @param {number} [options.logLevel] - Alias for debugLevel
|
|
233
|
+
* @param {string} [options.prefix] - Prefix to prepend to all log messages
|
|
234
|
+
* @param {object} [options.colours] - Colour configuration object
|
|
235
|
+
* @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
236
|
+
* @param {boolean} [options.stackTrace] - Enable stack trace extraction
|
|
237
|
+
* @param {boolean} [options.tagsAsStrings] - Use string tags instead of symbols
|
|
238
|
+
* @param {boolean} [options.displayName] - Display logger name in output
|
|
239
|
+
* @returns {Glog} This Glog instance for chaining
|
|
240
|
+
*/
|
|
241
|
+
setOptions(options: {
|
|
242
|
+
name?: string;
|
|
243
|
+
debugLevel?: number;
|
|
244
|
+
logLevel?: number;
|
|
245
|
+
prefix?: string;
|
|
246
|
+
colours?: object;
|
|
247
|
+
symbols?: object;
|
|
248
|
+
stackTrace?: boolean;
|
|
249
|
+
tagsAsStrings?: boolean;
|
|
250
|
+
displayName?: boolean;
|
|
251
|
+
}): Glog;
|
|
252
|
+
/**
|
|
253
|
+
* Set the logger name for this instance
|
|
254
|
+
*
|
|
255
|
+
* @param {string} name - Logger name to display in output
|
|
256
|
+
* @returns {Glog} This Glog instance for chaining
|
|
257
|
+
*/
|
|
258
|
+
withName(name: string): Glog;
|
|
259
|
+
/**
|
|
260
|
+
* Set the log level for this instance (0-5)
|
|
261
|
+
*
|
|
262
|
+
* @param {number} level - Log level (0 = off, 1-5 = increasing verbosity)
|
|
263
|
+
* @returns {Glog} This Glog instance for chaining
|
|
264
|
+
*/
|
|
265
|
+
withLogLevel(level: number): Glog;
|
|
266
|
+
/**
|
|
267
|
+
* Set the log prefix for this instance
|
|
268
|
+
*
|
|
269
|
+
* @param {string} prefix - Prefix to prepend to all log messages
|
|
270
|
+
* @returns {Glog} This Glog instance for chaining
|
|
271
|
+
*/
|
|
272
|
+
withPrefix(prefix: string): Glog;
|
|
273
|
+
/**
|
|
274
|
+
* Enable colours for this logger instance
|
|
275
|
+
* Merges with existing colour configuration (can pass partial config)
|
|
171
276
|
* Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
|
|
172
|
-
* - debug: Array of 5
|
|
173
|
-
* - info, warn, error, reset: Single
|
|
277
|
+
* - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
|
|
278
|
+
* - info, warn, error, reset: Single colour code strings
|
|
174
279
|
* Uses @gesslar/colours format like "{F196}"
|
|
175
280
|
*
|
|
176
|
-
* @param {object} [
|
|
281
|
+
* @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
|
|
282
|
+
* @returns {Glog} This Glog instance for chaining
|
|
283
|
+
*/
|
|
284
|
+
withColours(colours?: object): Glog;
|
|
285
|
+
/**
|
|
286
|
+
* Enable or disable stack trace extraction for this instance
|
|
287
|
+
*
|
|
288
|
+
* @param {boolean} [enabled=true] - Whether to enable stack traces
|
|
289
|
+
* @returns {Glog} This Glog instance for chaining
|
|
290
|
+
*/
|
|
291
|
+
withStackTrace(enabled?: boolean): Glog;
|
|
292
|
+
/**
|
|
293
|
+
* Use tag names as strings instead of symbols for this instance
|
|
294
|
+
*
|
|
295
|
+
* @param {boolean} [enabled=false] - Whether to use string tags
|
|
296
|
+
* @returns {Glog} This Glog instance for chaining
|
|
297
|
+
*/
|
|
298
|
+
withTagsAsStrings(enabled?: boolean): Glog;
|
|
299
|
+
/**
|
|
300
|
+
* Customize log level symbols for this logger instance
|
|
301
|
+
* Merges with existing symbols (can pass partial config)
|
|
302
|
+
* Only affects output when tagsAsStrings is false
|
|
303
|
+
* Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
|
|
304
|
+
*
|
|
305
|
+
* @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
|
|
177
306
|
* @returns {Glog} This Glog instance for chaining
|
|
307
|
+
* @example
|
|
308
|
+
* logger.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
|
|
309
|
+
*/
|
|
310
|
+
withSymbols(symbols?: object): Glog;
|
|
311
|
+
/**
|
|
312
|
+
* Disable displaying the logger name in output for this instance
|
|
313
|
+
*
|
|
314
|
+
* @returns {Glog} This Glog instance for chaining
|
|
315
|
+
*/
|
|
316
|
+
noDisplayName(): Glog;
|
|
317
|
+
/**
|
|
318
|
+
* Create a temporary scoped logger with a custom prefix for a single chain
|
|
319
|
+
* The prefix replaces all formatting (name, tags) with just the prefix + message
|
|
320
|
+
*
|
|
321
|
+
* @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
|
|
322
|
+
* @returns {object} Temporary logger with all standard methods
|
|
323
|
+
* @example
|
|
324
|
+
* logger.use("=>").info("Indented message") // => Indented message
|
|
325
|
+
* logger.info("Back to normal") // [MyApp] i Back to normal
|
|
326
|
+
*/
|
|
327
|
+
use(prefix: string): object;
|
|
328
|
+
/**
|
|
329
|
+
* Get the current logger name
|
|
330
|
+
*
|
|
331
|
+
* @returns {string} The logger name
|
|
178
332
|
*/
|
|
179
|
-
withColors(colors?: object): Glog;
|
|
180
|
-
withStackTrace(enabled?: boolean): this;
|
|
181
|
-
withTagsAsStrings(enabled?: boolean): this;
|
|
182
|
-
noDisplayName(): this;
|
|
183
333
|
get name(): string;
|
|
334
|
+
/**
|
|
335
|
+
* Get the current debug level
|
|
336
|
+
*
|
|
337
|
+
* @returns {number} The debug level (0-5)
|
|
338
|
+
*/
|
|
184
339
|
get debugLevel(): number;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Get the current logger options configuration
|
|
342
|
+
*
|
|
343
|
+
* @returns {object} The logger options
|
|
344
|
+
* @returns {string} return.name - Logger name
|
|
345
|
+
* @returns {number} return.debugLevel - Debug level
|
|
346
|
+
* @returns {string} return.prefix - Log prefix
|
|
347
|
+
* @returns {object} return.colours - Colour configuration
|
|
348
|
+
* @returns {boolean} return.stackTrace - Stack trace enabled
|
|
349
|
+
*/
|
|
350
|
+
get options(): object;
|
|
351
|
+
/**
|
|
352
|
+
* Extract file and function information from stack trace
|
|
353
|
+
*
|
|
354
|
+
* @private
|
|
355
|
+
* @returns {string} Caller tag
|
|
356
|
+
*/
|
|
357
|
+
private extractFileFunction;
|
|
358
|
+
/**
|
|
359
|
+
* Create a new debug function with a specific tag
|
|
360
|
+
*
|
|
361
|
+
* @param {string} tag - Tag to prepend to debug messages
|
|
362
|
+
* @returns {Function} Debug function with the tag
|
|
363
|
+
*/
|
|
364
|
+
newDebug(tag: string): Function;
|
|
194
365
|
/**
|
|
195
366
|
* Log a debug message with specified verbosity level.
|
|
196
367
|
* Level 0 means debug OFF - use levels 1-4 for actual debug output.
|
|
@@ -202,20 +373,44 @@ declare class Glog {
|
|
|
202
373
|
* @throws {Error} If level < 1 (level 0 = debug OFF)
|
|
203
374
|
*/
|
|
204
375
|
debug(message: string, level?: number, ...arg: unknown[]): void;
|
|
205
|
-
info(message: any, ...arg: any[]): void;
|
|
206
|
-
warn(message: any, ...arg: any[]): void;
|
|
207
|
-
error(message: any, ...arg: any[]): void;
|
|
208
|
-
execute(...args: any[]): void;
|
|
209
376
|
/**
|
|
210
|
-
* Log
|
|
377
|
+
* Log an informational message
|
|
378
|
+
*
|
|
379
|
+
* @param {string} message - Info message to log
|
|
380
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
381
|
+
*/
|
|
382
|
+
info(message: string, ...arg: unknown[]): void;
|
|
383
|
+
/**
|
|
384
|
+
* Log a warning message
|
|
385
|
+
*
|
|
386
|
+
* @param {string} message - Warning message to log
|
|
387
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
388
|
+
*/
|
|
389
|
+
warn(message: string, ...arg: unknown[]): void;
|
|
390
|
+
/**
|
|
391
|
+
* Log an error message
|
|
392
|
+
*
|
|
393
|
+
* @param {string} message - Error message to log
|
|
394
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
395
|
+
*/
|
|
396
|
+
error(message: string, ...arg: unknown[]): void;
|
|
397
|
+
/**
|
|
398
|
+
* Instance execute method for configured loggers
|
|
399
|
+
* Can be called as: logger(data) or logger(level, data)
|
|
400
|
+
*
|
|
401
|
+
* @param {...unknown} args - Arguments (optional level number, then data)
|
|
402
|
+
*/
|
|
403
|
+
execute(...args: unknown[]): void;
|
|
404
|
+
/**
|
|
405
|
+
* Log a colourized message using template literals
|
|
211
406
|
*
|
|
212
407
|
* @param {Array<string>} strings - Template strings
|
|
213
408
|
* @param {...unknown} values - Template values
|
|
214
|
-
* @example logger.
|
|
409
|
+
* @example logger.colourize`{success}Operation completed{/} in {bold}${time}ms{/}`
|
|
215
410
|
*/
|
|
216
|
-
|
|
411
|
+
colourize(strings: Array<string>, ...values: unknown[]): void;
|
|
217
412
|
/**
|
|
218
|
-
* Log a success message with green
|
|
413
|
+
* Log a success message with green colour
|
|
219
414
|
*
|
|
220
415
|
* @param {string} message - Success message
|
|
221
416
|
* @param {...unknown} args - Additional arguments
|
|
@@ -275,6 +470,15 @@ declare class Glog {
|
|
|
275
470
|
* Get a raw logger that outputs without name/tag formatting
|
|
276
471
|
*
|
|
277
472
|
* @returns {object} Raw logger interface
|
|
473
|
+
* @returns {Function} return.debug - Raw debug output function
|
|
474
|
+
* @returns {Function} return.info - Raw info output function
|
|
475
|
+
* @returns {Function} return.warn - Raw warning output function
|
|
476
|
+
* @returns {Function} return.error - Raw error output function
|
|
477
|
+
* @returns {Function} return.log - Raw log output function
|
|
478
|
+
* @returns {Function} return.success - Raw success output function
|
|
479
|
+
* @returns {Function} return.table - Raw table output function
|
|
480
|
+
* @returns {Function} return.group - Raw group start function
|
|
481
|
+
* @returns {Function} return.groupEnd - Raw group end function
|
|
278
482
|
*/
|
|
279
483
|
get raw(): object;
|
|
280
484
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Glog.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Glog.d.ts","sourceRoot":"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