@epigraph/epigraph-std-lib 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EpigraphLogger/epigraph-logger.d.ts +111 -27
- package/dist/epigraph-std-lib.js +135 -39
- package/package.json +1 -1
|
@@ -1,46 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
export interface LoggerLevel {
|
|
1
|
+
interface LoggerMode {
|
|
3
2
|
name: string;
|
|
4
3
|
allows: Array<string>;
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
release:
|
|
8
|
-
staging:
|
|
9
|
-
dev:
|
|
5
|
+
interface LoggerModes {
|
|
6
|
+
release: LoggerMode;
|
|
7
|
+
staging: LoggerMode;
|
|
8
|
+
dev: LoggerMode;
|
|
10
9
|
}
|
|
11
|
-
export declare enum
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export declare enum LoggerModeNames {
|
|
11
|
+
Release = "release",
|
|
12
|
+
Staging = "staging",
|
|
13
|
+
Dev = "dev"
|
|
15
14
|
}
|
|
16
|
-
export declare enum
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export declare enum LogTypes {
|
|
16
|
+
Info = "info",
|
|
17
|
+
Warn = "warn",
|
|
18
|
+
Error = "error"
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Epigraph's Logger class that provides various modes and functionalities to easily
|
|
22
|
+
* manage logging within our solutions in a consistent manner.
|
|
23
|
+
*
|
|
24
|
+
* Some common terminologies are:
|
|
25
|
+
* Mode: A logger's mode defines what log types would be automatically executed and
|
|
26
|
+
* what would be ignored.
|
|
24
27
|
*/
|
|
25
28
|
declare class EpigraphLogger {
|
|
26
29
|
context: string;
|
|
27
|
-
private
|
|
28
|
-
private
|
|
30
|
+
private _allModes;
|
|
31
|
+
private _currentMode;
|
|
29
32
|
/**
|
|
30
33
|
* @param {string} [context="EPIGRAPH-LOGGER"] Used to categorise each message within
|
|
31
34
|
* the console.
|
|
32
35
|
* @example,CORE, UI
|
|
33
36
|
*/
|
|
34
37
|
constructor(context: string);
|
|
35
|
-
get
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
get modes(): LoggerModes;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {LoggerModeNames} newValue Sets the logger mode of the current instance.
|
|
42
|
+
*/
|
|
43
|
+
setCurrentMode(newValue: LoggerModeNames): void;
|
|
44
|
+
private _isLogTypeAllowedInCurrentMode;
|
|
45
|
+
/**
|
|
46
|
+
* A log type that doesn't necessarily need to be looked at by the end user.
|
|
47
|
+
* This can be any generic log that would be ignored in most logger modes except verbose.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} title A short title for this log.
|
|
50
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
51
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
52
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
53
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
54
|
+
* that was provided at the time of initialisation of this class.
|
|
55
|
+
*/
|
|
56
|
+
info(title?: string, details?: any, contextOverride?: string | undefined): void;
|
|
57
|
+
/**
|
|
58
|
+
* A warning log type that let's the user know that some action that could be dangerous was just
|
|
59
|
+
* performed and might need attention.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} title A short title for this log.
|
|
62
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
63
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
64
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
65
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
66
|
+
* that was provided at the time of initialisation of this class.
|
|
67
|
+
*/
|
|
68
|
+
warn(title?: string, details?: any, contextOverride?: string | undefined): void;
|
|
69
|
+
/**
|
|
70
|
+
* A critical error log type that let's the user know that some action that was unexpected and required immediate attention.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} title A short title for this log.
|
|
73
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
74
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
75
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
76
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
77
|
+
* that was provided at the time of initialisation of this class.
|
|
78
|
+
*/
|
|
79
|
+
error(title?: string, details?: any, contextOverride?: string | undefined): void;
|
|
80
|
+
/**
|
|
81
|
+
* A table log type that can show an object in an organised manner within the console.
|
|
82
|
+
* This is primarily for the visual purposes and doesn't provide any additional functionality
|
|
83
|
+
* that other log types cannot provide.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} title A short title for this log.
|
|
86
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
87
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
88
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
89
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
90
|
+
* that was provided at the time of initialisation of this class.
|
|
91
|
+
* @param {LogTypes} logType A
|
|
92
|
+
*/
|
|
93
|
+
table(title?: string, details?: any, contextOverride?: string | undefined, logType?: LogTypes): void;
|
|
94
|
+
/**
|
|
95
|
+
* Begins an expanded group with the browser's console window.
|
|
96
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
97
|
+
*
|
|
98
|
+
* @param {string} title A short title for this group.
|
|
99
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
100
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
101
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
102
|
+
* that was provided at the time of initialisation of this class.
|
|
103
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
104
|
+
* info but this parameter allows the user to override this.
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
group(title: string, contextOverride?: string | undefined, logType?: LogTypes): void;
|
|
108
|
+
/**
|
|
109
|
+
* Begins a collapsed group with the browser's console window.
|
|
110
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
111
|
+
*
|
|
112
|
+
* @param {string} title A short title for this group.
|
|
113
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
114
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
115
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
116
|
+
* that was provided at the time of initialisation of this class.
|
|
117
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
118
|
+
* info but this parameter allows the user to override this.
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
groupCollapsed(title: string, contextOverride?: string | undefined, logType?: LogTypes): void;
|
|
122
|
+
/**
|
|
123
|
+
* Similar to the console.groupEnd(). Useful for ending either a group or
|
|
124
|
+
* groupCollapse that was initialised by this logger.
|
|
125
|
+
*
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
44
128
|
groupEnd(): void;
|
|
45
129
|
}
|
|
46
130
|
export { EpigraphLogger };
|
package/dist/epigraph-std-lib.js
CHANGED
|
@@ -31615,7 +31615,7 @@ const KR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
31615
31615
|
ModelViewerElement: dv,
|
|
31616
31616
|
NearestFilter: pt
|
|
31617
31617
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
31618
|
-
var GB = /* @__PURE__ */ ((a) => (a.
|
|
31618
|
+
var GB = /* @__PURE__ */ ((a) => (a.Release = "release", a.Staging = "staging", a.Dev = "dev", a))(GB || {}), zB = /* @__PURE__ */ ((a) => (a.Info = "info", a.Warn = "warn", a.Error = "error", a))(zB || {});
|
|
31619
31619
|
class jR {
|
|
31620
31620
|
/**
|
|
31621
31621
|
* @param {string} [context="EPIGRAPH-LOGGER"] Used to categorise each message within
|
|
@@ -31624,61 +31624,157 @@ class jR {
|
|
|
31624
31624
|
*/
|
|
31625
31625
|
constructor(e) {
|
|
31626
31626
|
Ca(this, "context", "EPIGRAPH-LOGGER");
|
|
31627
|
-
Ca(this, "
|
|
31627
|
+
Ca(this, "_allModes", {
|
|
31628
31628
|
release: { name: "release", allows: ["error"] },
|
|
31629
31629
|
staging: { name: "staging", allows: ["warn", "error"] },
|
|
31630
31630
|
dev: { name: "dev", allows: ["log", "warn", "error"] }
|
|
31631
31631
|
});
|
|
31632
|
-
Ca(this, "
|
|
31632
|
+
Ca(this, "_currentMode", "release");
|
|
31633
31633
|
e && (this.context = e.toLocaleUpperCase());
|
|
31634
31634
|
}
|
|
31635
|
-
get
|
|
31636
|
-
return this.
|
|
31635
|
+
get modes() {
|
|
31636
|
+
return this._allModes;
|
|
31637
31637
|
}
|
|
31638
|
-
|
|
31639
|
-
|
|
31640
|
-
|
|
31638
|
+
/**
|
|
31639
|
+
*
|
|
31640
|
+
* @param {LoggerModeNames} newValue Sets the logger mode of the current instance.
|
|
31641
|
+
*/
|
|
31642
|
+
setCurrentMode(e) {
|
|
31643
|
+
if (!Object.keys(this._allModes).includes(e)) {
|
|
31644
|
+
console.warn(`"${e}": is not a valid logger mode`);
|
|
31641
31645
|
return;
|
|
31642
31646
|
}
|
|
31643
|
-
this.
|
|
31647
|
+
this._currentMode = e;
|
|
31644
31648
|
}
|
|
31645
|
-
|
|
31646
|
-
return this.
|
|
31649
|
+
_isLogTypeAllowedInCurrentMode(e) {
|
|
31650
|
+
return this._allModes[this._currentMode].allows.includes(e);
|
|
31647
31651
|
}
|
|
31648
|
-
|
|
31649
|
-
|
|
31650
|
-
|
|
31651
|
-
|
|
31652
|
-
|
|
31652
|
+
/**
|
|
31653
|
+
* A log type that doesn't necessarily need to be looked at by the end user.
|
|
31654
|
+
* This can be any generic log that would be ignored in most logger modes except verbose.
|
|
31655
|
+
*
|
|
31656
|
+
* @param {string} title A short title for this log.
|
|
31657
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
31658
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31659
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31660
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31661
|
+
* that was provided at the time of initialisation of this class.
|
|
31662
|
+
*/
|
|
31663
|
+
info(e = "", t = "", n = void 0) {
|
|
31664
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
31665
|
+
"info"
|
|
31666
|
+
/* Info */
|
|
31667
|
+
))
|
|
31668
|
+
return;
|
|
31669
|
+
const i = n || this.context;
|
|
31670
|
+
console.groupCollapsed(`[${i}]: ${e}`), console.log(t), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
31653
31671
|
}
|
|
31654
|
-
|
|
31655
|
-
|
|
31672
|
+
/**
|
|
31673
|
+
* A warning log type that let's the user know that some action that could be dangerous was just
|
|
31674
|
+
* performed and might need attention.
|
|
31675
|
+
*
|
|
31676
|
+
* @param {string} title A short title for this log.
|
|
31677
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
31678
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31679
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31680
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31681
|
+
* that was provided at the time of initialisation of this class.
|
|
31682
|
+
*/
|
|
31683
|
+
warn(e = "", t = "", n = void 0) {
|
|
31684
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
31656
31685
|
"warn"
|
|
31657
|
-
/*
|
|
31658
|
-
)
|
|
31659
|
-
|
|
31660
|
-
|
|
31661
|
-
), console.warn(t), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd()
|
|
31662
|
-
}
|
|
31663
|
-
|
|
31664
|
-
|
|
31686
|
+
/* Warn */
|
|
31687
|
+
))
|
|
31688
|
+
return;
|
|
31689
|
+
const i = n || this.context;
|
|
31690
|
+
console.groupCollapsed(`%c[${i}]: ${e}`, "color: orange;"), console.warn(t), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
31691
|
+
}
|
|
31692
|
+
/**
|
|
31693
|
+
* A critical error log type that let's the user know that some action that was unexpected and required immediate attention.
|
|
31694
|
+
*
|
|
31695
|
+
* @param {string} title A short title for this log.
|
|
31696
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
31697
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31698
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31699
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31700
|
+
* that was provided at the time of initialisation of this class.
|
|
31701
|
+
*/
|
|
31702
|
+
error(e = "", t = "", n = void 0) {
|
|
31703
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
31665
31704
|
"error"
|
|
31666
|
-
/*
|
|
31667
|
-
)
|
|
31705
|
+
/* Error */
|
|
31706
|
+
))
|
|
31707
|
+
return;
|
|
31708
|
+
const i = n || this.context;
|
|
31709
|
+
console.groupCollapsed(`%c[${i}]: ${e}`, "color: red;"), console.error(t), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
31668
31710
|
}
|
|
31669
|
-
|
|
31670
|
-
|
|
31711
|
+
/**
|
|
31712
|
+
* A table log type that can show an object in an organised manner within the console.
|
|
31713
|
+
* This is primarily for the visual purposes and doesn't provide any additional functionality
|
|
31714
|
+
* that other log types cannot provide.
|
|
31715
|
+
*
|
|
31716
|
+
* @param {string} title A short title for this log.
|
|
31717
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
31718
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31719
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31720
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31721
|
+
* that was provided at the time of initialisation of this class.
|
|
31722
|
+
* @param {LogTypes} logType A
|
|
31723
|
+
*/
|
|
31724
|
+
table(e = "", t = {}, n = void 0, i = "info") {
|
|
31725
|
+
if (!this._isLogTypeAllowedInCurrentMode(i))
|
|
31726
|
+
return;
|
|
31727
|
+
const s = n || this.context;
|
|
31728
|
+
console.groupCollapsed(`[${s}]: ${e}`), console.table(t), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
31671
31729
|
}
|
|
31672
|
-
|
|
31673
|
-
|
|
31730
|
+
/**
|
|
31731
|
+
* Begins an expanded group with the browser's console window.
|
|
31732
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
31733
|
+
*
|
|
31734
|
+
* @param {string} title A short title for this group.
|
|
31735
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31736
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31737
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31738
|
+
* that was provided at the time of initialisation of this class.
|
|
31739
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
31740
|
+
* info but this parameter allows the user to override this.
|
|
31741
|
+
* @returns {void}
|
|
31742
|
+
*/
|
|
31743
|
+
group(e, t = void 0, n = "info") {
|
|
31744
|
+
if (!this._isLogTypeAllowedInCurrentMode(n))
|
|
31745
|
+
return;
|
|
31746
|
+
const i = t || this.context;
|
|
31747
|
+
console.group(`%c ${i} GROUP`, e);
|
|
31674
31748
|
}
|
|
31675
|
-
|
|
31676
|
-
|
|
31749
|
+
/**
|
|
31750
|
+
* Begins a collapsed group with the browser's console window.
|
|
31751
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
31752
|
+
*
|
|
31753
|
+
* @param {string} title A short title for this group.
|
|
31754
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
31755
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
31756
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
31757
|
+
* that was provided at the time of initialisation of this class.
|
|
31758
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
31759
|
+
* info but this parameter allows the user to override this.
|
|
31760
|
+
* @returns {void}
|
|
31761
|
+
*/
|
|
31762
|
+
groupCollapsed(e, t = void 0, n = "info") {
|
|
31763
|
+
if (!this._isLogTypeAllowedInCurrentMode(n))
|
|
31764
|
+
return;
|
|
31765
|
+
const i = t || this.context;
|
|
31766
|
+
console.groupCollapsed(`%c ${i} GROUP`, e);
|
|
31677
31767
|
}
|
|
31768
|
+
/**
|
|
31769
|
+
* Similar to the console.groupEnd(). Useful for ending either a group or
|
|
31770
|
+
* groupCollapse that was initialised by this logger.
|
|
31771
|
+
*
|
|
31772
|
+
* @returns {void}
|
|
31773
|
+
*/
|
|
31678
31774
|
groupEnd() {
|
|
31679
|
-
this.
|
|
31680
|
-
"
|
|
31681
|
-
/*
|
|
31775
|
+
this._isLogTypeAllowedInCurrentMode(
|
|
31776
|
+
"info"
|
|
31777
|
+
/* Info */
|
|
31682
31778
|
) && (console.log("----------------------------------"), console.groupEnd());
|
|
31683
31779
|
}
|
|
31684
31780
|
}
|
|
@@ -33085,7 +33181,8 @@ export {
|
|
|
33085
33181
|
Yt as Loader,
|
|
33086
33182
|
ha as LoaderUtils,
|
|
33087
33183
|
j0 as LoadingManager,
|
|
33088
|
-
|
|
33184
|
+
zB as LogTypes,
|
|
33185
|
+
GB as LoggerModeNames,
|
|
33089
33186
|
g0 as LoopOnce,
|
|
33090
33187
|
Qd as LoopPingPong,
|
|
33091
33188
|
Fd as LoopRepeat,
|
|
@@ -33215,7 +33312,6 @@ export {
|
|
|
33215
33312
|
Wf as SIGNED_RED_RGTC1_Format,
|
|
33216
33313
|
Bn as SRGBColorSpace,
|
|
33217
33314
|
wi as Scene,
|
|
33218
|
-
zB as Severities,
|
|
33219
33315
|
Ge as ShaderChunk,
|
|
33220
33316
|
$n as ShaderLib,
|
|
33221
33317
|
En as ShaderMaterial,
|