@gesslar/toolkit 2.3.2 → 2.5.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 +1 -1
- package/src/lib/Glog.js +288 -6
- package/src/lib/Term.js +71 -0
- package/src/types/lib/Glog.d.ts +115 -0
- package/src/types/lib/Glog.d.ts.map +1 -1
- package/src/types/lib/Term.d.ts +14 -0
- package/src/types/lib/Term.d.ts.map +1 -1
package/package.json
CHANGED
package/src/lib/Glog.js
CHANGED
|
@@ -33,6 +33,15 @@ export const loggerColours = {
|
|
|
33
33
|
reset: "{/}", // Reset
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Symbol alternatives for tags
|
|
37
|
+
export const logSymbols = {
|
|
38
|
+
debug: "?",
|
|
39
|
+
info: "i",
|
|
40
|
+
warn: "!",
|
|
41
|
+
error: "✗",
|
|
42
|
+
success: "✓"
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
// Set up convenient aliases for common log colors
|
|
37
46
|
c.alias.set("debug", "{F033}")
|
|
38
47
|
c.alias.set("info", "{F036}")
|
|
@@ -50,6 +59,7 @@ class Glog {
|
|
|
50
59
|
static colors = null
|
|
51
60
|
static stackTrace = false
|
|
52
61
|
static name = ""
|
|
62
|
+
static tagsAsStrings = false
|
|
53
63
|
|
|
54
64
|
// Instance properties (for configured loggers)
|
|
55
65
|
#logLevel = 0
|
|
@@ -57,6 +67,8 @@ class Glog {
|
|
|
57
67
|
#colors = null
|
|
58
68
|
#stackTrace = false
|
|
59
69
|
#name = ""
|
|
70
|
+
#tagsAsStrings = false
|
|
71
|
+
#displayName = true
|
|
60
72
|
#vscodeError = null
|
|
61
73
|
#vscodeWarn = null
|
|
62
74
|
#vscodeInfo = null
|
|
@@ -87,6 +99,8 @@ class Glog {
|
|
|
87
99
|
this.#logPrefix = options.prefix ?? this.#logPrefix
|
|
88
100
|
this.#colors = options.colors ?? this.#colors
|
|
89
101
|
this.#stackTrace = options.stackTrace ?? this.#stackTrace
|
|
102
|
+
this.#tagsAsStrings = options.tagsAsStrings ?? this.#tagsAsStrings
|
|
103
|
+
this.#displayName = options.displayName ?? this.#displayName
|
|
90
104
|
|
|
91
105
|
return this
|
|
92
106
|
}
|
|
@@ -123,6 +137,12 @@ class Glog {
|
|
|
123
137
|
return this
|
|
124
138
|
}
|
|
125
139
|
|
|
140
|
+
static withTagsAsStrings(enabled = false) {
|
|
141
|
+
this.tagsAsStrings = enabled
|
|
142
|
+
|
|
143
|
+
return this
|
|
144
|
+
}
|
|
145
|
+
|
|
126
146
|
// === FLUENT INSTANCE CREATION ===
|
|
127
147
|
|
|
128
148
|
static create(options = {}) {
|
|
@@ -159,6 +179,18 @@ class Glog {
|
|
|
159
179
|
return this
|
|
160
180
|
}
|
|
161
181
|
|
|
182
|
+
withTagsAsStrings(enabled = false) {
|
|
183
|
+
this.#tagsAsStrings = enabled
|
|
184
|
+
|
|
185
|
+
return this
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
noDisplayName() {
|
|
189
|
+
this.#displayName = false
|
|
190
|
+
|
|
191
|
+
return this
|
|
192
|
+
}
|
|
193
|
+
|
|
162
194
|
// === UTILITY METHODS ===
|
|
163
195
|
|
|
164
196
|
get name() {
|
|
@@ -182,19 +214,28 @@ class Glog {
|
|
|
182
214
|
#compose(level, message, debugLevel = 0) {
|
|
183
215
|
const colors = this.#colors || Glog.colors || loggerColours
|
|
184
216
|
const name = this.#name || Glog.name || "Log"
|
|
185
|
-
const
|
|
217
|
+
const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
|
|
218
|
+
const showName = this.#displayName
|
|
219
|
+
const tag = useStrings ? Util.capitalize(level) : logSymbols[level]
|
|
220
|
+
const namePrefix = showName ? `[${name}] ` : ""
|
|
186
221
|
|
|
187
222
|
if(!colors) {
|
|
188
|
-
return
|
|
223
|
+
return useStrings
|
|
224
|
+
? `${namePrefix}${tag}: ${message}`
|
|
225
|
+
: `${namePrefix}${tag} ${message}`
|
|
189
226
|
}
|
|
190
227
|
|
|
191
228
|
if(level === "debug") {
|
|
192
229
|
const colorCode = colors[level][debugLevel] || colors[level][0]
|
|
193
230
|
|
|
194
|
-
return
|
|
231
|
+
return useStrings
|
|
232
|
+
? c`${namePrefix}${colorCode}${tag}{/}: ${message}`
|
|
233
|
+
: c`${namePrefix}${colorCode}${tag}{/} ${message}`
|
|
195
234
|
}
|
|
196
235
|
|
|
197
|
-
return
|
|
236
|
+
return useStrings
|
|
237
|
+
? c`${namePrefix}${colors[level]}${tag}{/}: ${message}`
|
|
238
|
+
: c`${namePrefix}${colors[level]}${tag}{/} ${message}`
|
|
198
239
|
}
|
|
199
240
|
|
|
200
241
|
// Stack trace functionality - simplified for now
|
|
@@ -342,7 +383,16 @@ class Glog {
|
|
|
342
383
|
* @param {...unknown} args - Additional arguments
|
|
343
384
|
*/
|
|
344
385
|
success(message, ...args) {
|
|
345
|
-
|
|
386
|
+
const name = this.#name || Glog.name || "Log"
|
|
387
|
+
const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
|
|
388
|
+
const showName = this.#displayName
|
|
389
|
+
const tag = useStrings ? "Success" : logSymbols.success
|
|
390
|
+
const namePrefix = showName ? `[${name}] ` : ""
|
|
391
|
+
const formatted = useStrings
|
|
392
|
+
? c`${namePrefix}{success}${tag}{/}: ${message}`
|
|
393
|
+
: c`${namePrefix}{success}${tag}{/} ${message}`
|
|
394
|
+
|
|
395
|
+
Term.log(formatted, ...args)
|
|
346
396
|
}
|
|
347
397
|
|
|
348
398
|
/**
|
|
@@ -352,7 +402,201 @@ class Glog {
|
|
|
352
402
|
* @param {...unknown} args - Additional arguments to log
|
|
353
403
|
*/
|
|
354
404
|
static success(message, ...args) {
|
|
355
|
-
|
|
405
|
+
const name = this.name || "Log"
|
|
406
|
+
const useStrings = this.tagsAsStrings
|
|
407
|
+
const tag = useStrings ? "Success" : logSymbols.success
|
|
408
|
+
const formatted = useStrings
|
|
409
|
+
? c`[${name}] {success}${tag}{/}: ${message}`
|
|
410
|
+
: c`[${name}] {success}${tag}{/} ${message}`
|
|
411
|
+
|
|
412
|
+
Term.log(formatted, ...args)
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Static group method - start a console group for indented output
|
|
417
|
+
*
|
|
418
|
+
* @param {...unknown} args - Optional group label
|
|
419
|
+
*/
|
|
420
|
+
static group(...args) {
|
|
421
|
+
const name = this.name || "Log"
|
|
422
|
+
const label = args.length > 0 ? ` ${args.join(" ")}` : ""
|
|
423
|
+
|
|
424
|
+
Term.group(`[${name}]${label}`)
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Static groupEnd method - end the current console group
|
|
429
|
+
*/
|
|
430
|
+
static groupEnd() {
|
|
431
|
+
Term.groupEnd()
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Static groupDebug - start a debug-tagged group
|
|
436
|
+
*
|
|
437
|
+
* @param {string} message - Group label
|
|
438
|
+
* @param {number} [level=1] - Debug level
|
|
439
|
+
*/
|
|
440
|
+
static groupDebug(message, level = 1) {
|
|
441
|
+
const colors = this.colors || loggerColours
|
|
442
|
+
const name = this.name || "Log"
|
|
443
|
+
const useStrings = this.tagsAsStrings
|
|
444
|
+
const tag = useStrings ? "Debug" : logSymbols.debug
|
|
445
|
+
const colorCode = colors.debug[level] || colors.debug[0]
|
|
446
|
+
const label = useStrings
|
|
447
|
+
? c`[${name}] ${colorCode}${tag}{/}: ${message}`
|
|
448
|
+
: c`[${name}] ${colorCode}${tag}{/} ${message}`
|
|
449
|
+
|
|
450
|
+
Term.group(label)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Static groupInfo - start an info-tagged group
|
|
455
|
+
*
|
|
456
|
+
* @param {string} message - Group label
|
|
457
|
+
*/
|
|
458
|
+
static groupInfo(message) {
|
|
459
|
+
const colors = this.colors || loggerColours
|
|
460
|
+
const name = this.name || "Log"
|
|
461
|
+
const useStrings = this.tagsAsStrings
|
|
462
|
+
const tag = useStrings ? "Info" : logSymbols.info
|
|
463
|
+
const label = useStrings
|
|
464
|
+
? c`[${name}] ${colors.info}${tag}{/}: ${message}`
|
|
465
|
+
: c`[${name}] ${colors.info}${tag}{/} ${message}`
|
|
466
|
+
|
|
467
|
+
Term.group(label)
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Static groupSuccess - start a success-tagged group
|
|
472
|
+
*
|
|
473
|
+
* @param {string} message - Group label
|
|
474
|
+
*/
|
|
475
|
+
static groupSuccess(message) {
|
|
476
|
+
const name = this.name || "Log"
|
|
477
|
+
const useStrings = this.tagsAsStrings
|
|
478
|
+
const tag = useStrings ? "Success" : logSymbols.success
|
|
479
|
+
const label = useStrings
|
|
480
|
+
? c`[${name}] {success}${tag}{/}: ${message}`
|
|
481
|
+
: c`[${name}] {success}${tag}{/} ${message}`
|
|
482
|
+
|
|
483
|
+
Term.group(label)
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Start a console group for indented output
|
|
488
|
+
*
|
|
489
|
+
* @param {...unknown} args - Optional group label
|
|
490
|
+
*/
|
|
491
|
+
group(...args) {
|
|
492
|
+
const name = this.#name || Glog.name || "Log"
|
|
493
|
+
const showName = this.#displayName
|
|
494
|
+
const label = args.length > 0 ? ` ${args.join(" ")}` : ""
|
|
495
|
+
const output = showName ? `[${name}]${label}` : label.trim()
|
|
496
|
+
|
|
497
|
+
Term.group(output)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* End the current console group
|
|
502
|
+
*/
|
|
503
|
+
groupEnd() {
|
|
504
|
+
Term.groupEnd()
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Start a debug-tagged group
|
|
509
|
+
*
|
|
510
|
+
* @param {string} message - Group label
|
|
511
|
+
* @param {number} [level=1] - Debug level
|
|
512
|
+
*/
|
|
513
|
+
groupDebug(message, level = 1) {
|
|
514
|
+
Term.group(this.#compose("debug", message, level))
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Start an info-tagged group
|
|
519
|
+
*
|
|
520
|
+
* @param {string} message - Group label
|
|
521
|
+
*/
|
|
522
|
+
groupInfo(message) {
|
|
523
|
+
Term.group(this.#compose("info", message))
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Start a success-tagged group
|
|
528
|
+
*
|
|
529
|
+
* @param {string} message - Group label
|
|
530
|
+
*/
|
|
531
|
+
groupSuccess(message) {
|
|
532
|
+
const name = this.#name || Glog.name || "Log"
|
|
533
|
+
const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
|
|
534
|
+
const showName = this.#displayName
|
|
535
|
+
const tag = useStrings ? "Success" : logSymbols.success
|
|
536
|
+
const namePrefix = showName ? `[${name}] ` : ""
|
|
537
|
+
const label = useStrings
|
|
538
|
+
? c`${namePrefix}{success}${tag}{/}: ${message}`
|
|
539
|
+
: c`${namePrefix}{success}${tag}{/} ${message}`
|
|
540
|
+
|
|
541
|
+
Term.group(label)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Display tabular data as a table
|
|
546
|
+
*
|
|
547
|
+
* @param {object | Array} data - Object or array to display
|
|
548
|
+
* @param {string | object} [labelOrOptions] - Optional label (string) or options (object)
|
|
549
|
+
* @param {object} [options] - Optional options when label is provided
|
|
550
|
+
* @param {Array<string>} [options.properties] - Column properties to display
|
|
551
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row
|
|
552
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings
|
|
553
|
+
*/
|
|
554
|
+
table(data, labelOrOptions, options) {
|
|
555
|
+
let label
|
|
556
|
+
let tableOptions = {}
|
|
557
|
+
|
|
558
|
+
// Parse polymorphic parameters
|
|
559
|
+
if(typeof labelOrOptions === "string") {
|
|
560
|
+
label = labelOrOptions
|
|
561
|
+
tableOptions = options || {}
|
|
562
|
+
} else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
|
|
563
|
+
tableOptions = labelOrOptions
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if(label) {
|
|
567
|
+
Term.log(c`[${this.#name || Glog.name || "Log"}] {info}Table{/}: ${label}`)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
Term.table(data, tableOptions)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Static table method
|
|
575
|
+
*
|
|
576
|
+
* @param {object | Array} data - Object or array to display
|
|
577
|
+
* @param {string | object} [labelOrOptions] - Optional label (string) or options (object)
|
|
578
|
+
* @param {object} [options] - Optional options when label is provided
|
|
579
|
+
* @param {Array<string>} [options.properties] - Column properties to display
|
|
580
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row
|
|
581
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings
|
|
582
|
+
*/
|
|
583
|
+
static table(data, labelOrOptions, options) {
|
|
584
|
+
let label
|
|
585
|
+
let tableOptions = {}
|
|
586
|
+
|
|
587
|
+
// Parse polymorphic parameters
|
|
588
|
+
if(typeof labelOrOptions === "string") {
|
|
589
|
+
label = labelOrOptions
|
|
590
|
+
tableOptions = options || {}
|
|
591
|
+
} else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
|
|
592
|
+
tableOptions = labelOrOptions
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if(label) {
|
|
596
|
+
Term.log(c`[${this.name || "Log"}] {info}Table{/}: ${label}`)
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
Term.table(data, tableOptions)
|
|
356
600
|
}
|
|
357
601
|
|
|
358
602
|
/**
|
|
@@ -376,6 +620,44 @@ class Glog {
|
|
|
376
620
|
get colours() {
|
|
377
621
|
return c
|
|
378
622
|
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Get a raw logger that outputs without name/tag formatting
|
|
626
|
+
*
|
|
627
|
+
* @returns {object} Raw logger interface
|
|
628
|
+
*/
|
|
629
|
+
get raw() {
|
|
630
|
+
return {
|
|
631
|
+
debug: (message, ...args) => Term.debug(message, ...args),
|
|
632
|
+
info: (message, ...args) => Term.info(message, ...args),
|
|
633
|
+
warn: (message, ...args) => Term.warn(message, ...args),
|
|
634
|
+
error: (message, ...args) => Term.error(message, ...args),
|
|
635
|
+
log: (...args) => Term.log(...args),
|
|
636
|
+
success: (message, ...args) => Term.log(message, ...args),
|
|
637
|
+
table: (data, options) => Term.table(data, options || {}),
|
|
638
|
+
group: (...args) => Term.group(...args),
|
|
639
|
+
groupEnd: () => Term.groupEnd()
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Static raw logger that outputs without name/tag formatting
|
|
645
|
+
*
|
|
646
|
+
* @returns {object} Raw logger interface
|
|
647
|
+
*/
|
|
648
|
+
static get raw() {
|
|
649
|
+
return {
|
|
650
|
+
debug: (message, ...args) => Term.debug(message, ...args),
|
|
651
|
+
info: (message, ...args) => Term.info(message, ...args),
|
|
652
|
+
warn: (message, ...args) => Term.warn(message, ...args),
|
|
653
|
+
error: (message, ...args) => Term.error(message, ...args),
|
|
654
|
+
log: (...args) => Term.log(...args),
|
|
655
|
+
success: (message, ...args) => Term.log(message, ...args),
|
|
656
|
+
table: (data, options) => Term.table(data, options || {}),
|
|
657
|
+
group: (...args) => Term.group(...args),
|
|
658
|
+
groupEnd: () => Term.groupEnd()
|
|
659
|
+
}
|
|
660
|
+
}
|
|
379
661
|
}
|
|
380
662
|
|
|
381
663
|
// Wrap in proxy for dual usage
|
package/src/lib/Term.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import console from "node:console"
|
|
2
2
|
import process from "node:process"
|
|
3
|
+
import {Console} from "node:console"
|
|
4
|
+
import {Writable} from "node:stream"
|
|
3
5
|
|
|
4
6
|
import Sass from "./Sass.js"
|
|
5
7
|
|
|
@@ -65,6 +67,75 @@ export default class Term {
|
|
|
65
67
|
console.groupEnd()
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Display tabular data as a table.
|
|
72
|
+
*
|
|
73
|
+
* @param {object | Array} tabularData - Object or array to display.
|
|
74
|
+
* @param {object} [options] - Table options.
|
|
75
|
+
* @param {Array<string>} [options.properties] - Optional column properties to display.
|
|
76
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row with column names.
|
|
77
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings.
|
|
78
|
+
*/
|
|
79
|
+
static table(tabularData, options = {}) {
|
|
80
|
+
const {properties, showHeader = false, quotedStrings = false} = options
|
|
81
|
+
|
|
82
|
+
if(showHeader && quotedStrings) {
|
|
83
|
+
// Simple case: use default console.table
|
|
84
|
+
console.table(tabularData, properties)
|
|
85
|
+
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Capture console.table output
|
|
90
|
+
let output = ""
|
|
91
|
+
const stream = new Writable({
|
|
92
|
+
write(chunk, encoding, callback) {
|
|
93
|
+
output += chunk.toString()
|
|
94
|
+
callback()
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Make stream appear as a TTY to preserve colors
|
|
99
|
+
stream.isTTY = true
|
|
100
|
+
stream.columns = process.stdout.columns
|
|
101
|
+
stream.rows = process.stdout.rows
|
|
102
|
+
stream.getColorDepth = () => process.stdout.getColorDepth?.() ?? 8
|
|
103
|
+
|
|
104
|
+
const tempConsole = new Console(stream)
|
|
105
|
+
|
|
106
|
+
tempConsole.table(tabularData, properties)
|
|
107
|
+
|
|
108
|
+
// Process output
|
|
109
|
+
let processed = output
|
|
110
|
+
|
|
111
|
+
// Remove quotes if requested
|
|
112
|
+
if(!quotedStrings) {
|
|
113
|
+
// Replace 'string' with string + 2 spaces to maintain alignment
|
|
114
|
+
// Use a more precise regex to avoid matching color codes
|
|
115
|
+
processed = processed.replace(/'([^']*)'/g, (match, content) => {
|
|
116
|
+
// Add 2 spaces to compensate for removed quotes
|
|
117
|
+
return content + " "
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Remove header row and separator line
|
|
122
|
+
const lines = processed.split("\n")
|
|
123
|
+
|
|
124
|
+
if(lines.length > 3 && !showHeader) {
|
|
125
|
+
// Remove the header row (line 1) and separator (line 2)
|
|
126
|
+
// Keep: top border (line 0), data rows (line 3+)
|
|
127
|
+
const modified = [lines[0], ...lines.slice(3)]
|
|
128
|
+
|
|
129
|
+
process.stdout.write(modified.join("\n"))
|
|
130
|
+
} else if(showHeader) {
|
|
131
|
+
// Keep header but remove quotes if requested
|
|
132
|
+
process.stdout.write(processed)
|
|
133
|
+
} else {
|
|
134
|
+
// Fallback: just output as-is if format unexpected
|
|
135
|
+
process.stdout.write(processed)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
68
139
|
/**
|
|
69
140
|
* Emit a status line to the terminal.
|
|
70
141
|
*
|
package/src/types/lib/Glog.d.ts
CHANGED
|
@@ -5,6 +5,17 @@ export namespace loggerColours {
|
|
|
5
5
|
let error: string;
|
|
6
6
|
let reset: string;
|
|
7
7
|
}
|
|
8
|
+
export namespace logSymbols {
|
|
9
|
+
let debug_1: string;
|
|
10
|
+
export { debug_1 as debug };
|
|
11
|
+
let info_1: string;
|
|
12
|
+
export { info_1 as info };
|
|
13
|
+
let warn_1: string;
|
|
14
|
+
export { warn_1 as warn };
|
|
15
|
+
let error_1: string;
|
|
16
|
+
export { error_1 as error };
|
|
17
|
+
export let success: string;
|
|
18
|
+
}
|
|
8
19
|
declare const _default: typeof Glog;
|
|
9
20
|
export default _default;
|
|
10
21
|
declare class Glog {
|
|
@@ -13,6 +24,7 @@ declare class Glog {
|
|
|
13
24
|
static colors: any;
|
|
14
25
|
static stackTrace: boolean;
|
|
15
26
|
static name: string;
|
|
27
|
+
static tagsAsStrings: boolean;
|
|
16
28
|
static setLogPrefix(prefix: any): typeof Glog;
|
|
17
29
|
static setLogLevel(level: any): typeof Glog;
|
|
18
30
|
static withName(name: any): typeof Glog;
|
|
@@ -24,6 +36,7 @@ declare class Glog {
|
|
|
24
36
|
reset: string;
|
|
25
37
|
}): typeof Glog;
|
|
26
38
|
static withStackTrace(enabled?: boolean): typeof Glog;
|
|
39
|
+
static withTagsAsStrings(enabled?: boolean): typeof Glog;
|
|
27
40
|
static create(options?: {}): Glog;
|
|
28
41
|
static execute(...args: any[]): void;
|
|
29
42
|
/**
|
|
@@ -40,6 +53,50 @@ declare class Glog {
|
|
|
40
53
|
* @param {...unknown} args - Additional arguments to log
|
|
41
54
|
*/
|
|
42
55
|
static success(message: string, ...args: unknown[]): void;
|
|
56
|
+
/**
|
|
57
|
+
* Static group method - start a console group for indented output
|
|
58
|
+
*
|
|
59
|
+
* @param {...unknown} args - Optional group label
|
|
60
|
+
*/
|
|
61
|
+
static group(...args: unknown[]): void;
|
|
62
|
+
/**
|
|
63
|
+
* Static groupEnd method - end the current console group
|
|
64
|
+
*/
|
|
65
|
+
static groupEnd(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Static groupDebug - start a debug-tagged group
|
|
68
|
+
*
|
|
69
|
+
* @param {string} message - Group label
|
|
70
|
+
* @param {number} [level=1] - Debug level
|
|
71
|
+
*/
|
|
72
|
+
static groupDebug(message: string, level?: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* Static groupInfo - start an info-tagged group
|
|
75
|
+
*
|
|
76
|
+
* @param {string} message - Group label
|
|
77
|
+
*/
|
|
78
|
+
static groupInfo(message: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Static groupSuccess - start a success-tagged group
|
|
81
|
+
*
|
|
82
|
+
* @param {string} message - Group label
|
|
83
|
+
*/
|
|
84
|
+
static groupSuccess(message: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Static table method
|
|
87
|
+
*
|
|
88
|
+
* @param {object | Array} data - Object or array to display
|
|
89
|
+
* @param {string | object} [labelOrOptions] - Optional label (string) or options (object)
|
|
90
|
+
* @param {object} [options] - Optional options when label is provided
|
|
91
|
+
* @param {Array<string>} [options.properties] - Column properties to display
|
|
92
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row
|
|
93
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings
|
|
94
|
+
*/
|
|
95
|
+
static table(data: object | any[], labelOrOptions?: string | object, options?: {
|
|
96
|
+
properties?: Array<string>;
|
|
97
|
+
showHeader?: boolean;
|
|
98
|
+
quotedStrings?: boolean;
|
|
99
|
+
}): void;
|
|
43
100
|
/**
|
|
44
101
|
* Set a color alias for convenient usage
|
|
45
102
|
*
|
|
@@ -48,6 +105,12 @@ declare class Glog {
|
|
|
48
105
|
* @returns {Glog} The Glog class for chaining.
|
|
49
106
|
*/
|
|
50
107
|
static setAlias(alias: string, colorCode: string): Glog;
|
|
108
|
+
/**
|
|
109
|
+
* Static raw logger that outputs without name/tag formatting
|
|
110
|
+
*
|
|
111
|
+
* @returns {object} Raw logger interface
|
|
112
|
+
*/
|
|
113
|
+
static get raw(): object;
|
|
51
114
|
constructor(options?: {});
|
|
52
115
|
setOptions(options: any): this;
|
|
53
116
|
withName(name: any): this;
|
|
@@ -61,6 +124,8 @@ declare class Glog {
|
|
|
61
124
|
reset: string;
|
|
62
125
|
}): this;
|
|
63
126
|
withStackTrace(enabled?: boolean): this;
|
|
127
|
+
withTagsAsStrings(enabled?: boolean): this;
|
|
128
|
+
noDisplayName(): this;
|
|
64
129
|
get name(): string;
|
|
65
130
|
get debugLevel(): number;
|
|
66
131
|
get options(): {
|
|
@@ -102,12 +167,62 @@ declare class Glog {
|
|
|
102
167
|
* @param {...unknown} args - Additional arguments
|
|
103
168
|
*/
|
|
104
169
|
success(message: string, ...args: unknown[]): void;
|
|
170
|
+
/**
|
|
171
|
+
* Start a console group for indented output
|
|
172
|
+
*
|
|
173
|
+
* @param {...unknown} args - Optional group label
|
|
174
|
+
*/
|
|
175
|
+
group(...args: unknown[]): void;
|
|
176
|
+
/**
|
|
177
|
+
* End the current console group
|
|
178
|
+
*/
|
|
179
|
+
groupEnd(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Start a debug-tagged group
|
|
182
|
+
*
|
|
183
|
+
* @param {string} message - Group label
|
|
184
|
+
* @param {number} [level=1] - Debug level
|
|
185
|
+
*/
|
|
186
|
+
groupDebug(message: string, level?: number): void;
|
|
187
|
+
/**
|
|
188
|
+
* Start an info-tagged group
|
|
189
|
+
*
|
|
190
|
+
* @param {string} message - Group label
|
|
191
|
+
*/
|
|
192
|
+
groupInfo(message: string): void;
|
|
193
|
+
/**
|
|
194
|
+
* Start a success-tagged group
|
|
195
|
+
*
|
|
196
|
+
* @param {string} message - Group label
|
|
197
|
+
*/
|
|
198
|
+
groupSuccess(message: string): void;
|
|
199
|
+
/**
|
|
200
|
+
* Display tabular data as a table
|
|
201
|
+
*
|
|
202
|
+
* @param {object | Array} data - Object or array to display
|
|
203
|
+
* @param {string | object} [labelOrOptions] - Optional label (string) or options (object)
|
|
204
|
+
* @param {object} [options] - Optional options when label is provided
|
|
205
|
+
* @param {Array<string>} [options.properties] - Column properties to display
|
|
206
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row
|
|
207
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings
|
|
208
|
+
*/
|
|
209
|
+
table(data: object | any[], labelOrOptions?: string | object, options?: {
|
|
210
|
+
properties?: Array<string>;
|
|
211
|
+
showHeader?: boolean;
|
|
212
|
+
quotedStrings?: boolean;
|
|
213
|
+
}): void;
|
|
105
214
|
/**
|
|
106
215
|
* Get access to the colours template function for instance usage
|
|
107
216
|
*
|
|
108
217
|
* @returns {import('@gesslar/colours')} The colours template function from \@gesslar/colours
|
|
109
218
|
*/
|
|
110
219
|
get colours(): typeof import("@gesslar/colours");
|
|
220
|
+
/**
|
|
221
|
+
* Get a raw logger that outputs without name/tag formatting
|
|
222
|
+
*
|
|
223
|
+
* @returns {object} Raw logger interface
|
|
224
|
+
*/
|
|
225
|
+
get raw(): object;
|
|
111
226
|
#private;
|
|
112
227
|
}
|
|
113
228
|
//# sourceMappingURL=Glog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../lib/Glog.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../lib/Glog.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA;IAEE,wBAAmB;IACnB,yBAAqB;IACrB,mBAAoB;IACpB,2BAAyB;IACzB,oBAAgB;IAChB,8BAA4B;IAgD5B,8CAIC;IAED,4CAIC;IAED,wCAIC;IAED;;;;;;oBAIC;IAED,sDAIC;IAED,yDAIC;IAID,kCAEC;IA6KD,qCAoBC;IAuBD;;;;;OAKG;IACH,yBAHW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAOpB;IAqBD;;;;;OAKG;IACH,wBAHW,MAAM,WACH,OAAO,EAAA,QAWpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAOpB;IAED;;OAEG;IACH,wBAEC;IAED;;;;;OAKG;IACH,2BAHW,MAAM,UACN,MAAM,QAahB;IAED;;;;OAIG;IACH,0BAFW,MAAM,QAYhB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAWhB;IAyFD;;;;;;;;;OASG;IACH,mBAPW,MAAM,QAAQ,mBACd,MAAM,GAAG,MAAM,YAEvB;QAAgC,UAAU,GAAlC,KAAK,CAAC,MAAM,CAAC;QACK,UAAU,GAA5B,OAAO;QACW,aAAa,GAA/B,OAAO;KACjB,QAkBA;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,aACN,MAAM,GACJ,IAAI,CAMhB;IA8BD;;;;OAIG;IACH,kBAFa,MAAM,CAclB;IAxkBD,0BAgBC;IAID,+BAUC;IA8CD,0BAIC;IAED,+BAIC;IAED,8BAIC;IAED;;;;;;aAIC;IAED,wCAIC;IAED,2CAIC;IAED,sBAIC;IAID,mBAEC;IAED,yBAEC;IAED;;;;;;MAQC;IA8BD,8BAGC;IAED,wBAQC;IA8BD;;;;;;;;;OASG;IACH,eALW,MAAM,UACN,MAAM,UACH,OAAO,EAAA,QAapB;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;IA0BD,8BAEC;IAID;;;;;;OAMG;IACH,kBAJW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAQpB;IAeD;;;;;OAKG;IACH,iBAHW,MAAM,WACH,OAAO,EAAA,QAapB;IA0FD;;;;OAIG;IACH,eAFc,OAAO,EAAA,QASpB;IAED;;OAEG;IACH,iBAEC;IAED;;;;;OAKG;IACH,oBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,mBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,sBAFW,MAAM,QAahB;IAED;;;;;;;;;OASG;IACH,YAPW,MAAM,QAAQ,mBACd,MAAM,GAAG,MAAM,YAEvB;QAAgC,UAAU,GAAlC,KAAK,CAAC,MAAM,CAAC;QACK,UAAU,GAA5B,OAAO;QACW,aAAa,GAA/B,OAAO;KACjB,QAkBA;IA4CD;;;;OAIG;IACH,iDAEC;IAED;;;;OAIG;IACH,WAFa,MAAM,CAclB;;CAoBF"}
|
package/src/types/lib/Term.d.ts
CHANGED
|
@@ -39,6 +39,20 @@ export default class Term {
|
|
|
39
39
|
* End the current console group.
|
|
40
40
|
*/
|
|
41
41
|
static groupEnd(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Display tabular data as a table.
|
|
44
|
+
*
|
|
45
|
+
* @param {object | Array} tabularData - Object or array to display.
|
|
46
|
+
* @param {object} [options] - Table options.
|
|
47
|
+
* @param {Array<string>} [options.properties] - Optional column properties to display.
|
|
48
|
+
* @param {boolean} [options.showHeader=false] - Whether to show the header row with column names.
|
|
49
|
+
* @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings.
|
|
50
|
+
*/
|
|
51
|
+
static table(tabularData: object | any[], options?: {
|
|
52
|
+
properties?: Array<string>;
|
|
53
|
+
showHeader?: boolean;
|
|
54
|
+
quotedStrings?: boolean;
|
|
55
|
+
}): void;
|
|
42
56
|
/**
|
|
43
57
|
* Emit a status line to the terminal.
|
|
44
58
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Term.d.ts","sourceRoot":"","sources":["../../lib/Term.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Term.d.ts","sourceRoot":"","sources":["../../lib/Term.js"],"names":[],"mappings":"AAOA;IACE;;;;OAIG;IACH,oBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;OAEG;IACH,wBAEC;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,QAAQ,YAEtB;QAAgC,UAAU,GAAlC,KAAK,CAAC,MAAM,CAAC;QACK,UAAU,GAA5B,OAAO;QACW,aAAa,GAA/B,OAAO;KACjB,QA2DA;IAED;;;;;;;;;;;;;;OAcG;IACH,oBALW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,eAEjD;QAAyB,MAAM,EAAvB,OAAO;KACf,GAAU,IAAI,CAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,gCAHW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GAClE,IAAI,CA4BhB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gDAJW,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CASlB;IAED,sCAGC;IAED,2CAEC;IAED,8CAIC;CACF"}
|