@xh/hoist 76.0.0-SNAPSHOT.1758150416326 → 76.0.0-SNAPSHOT.1758206730608

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.
@@ -36,7 +36,11 @@ export type LogSource = string | {displayName: string} | {constructor: {name: st
36
36
  * @internal - use public `XH.logLevel`.
37
37
  */
38
38
  export function getLogLevel() {
39
- return _logLevel;
39
+ try {
40
+ return _logLevel;
41
+ } catch (e) {
42
+ return 'info';
43
+ }
40
44
  }
41
45
 
42
46
  /**
@@ -128,7 +132,9 @@ export function logWarn(msgs: Some<unknown>, source?: LogSource) {
128
132
  // Implementation
129
133
  //----------------------------------
130
134
  function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, level: LogLevel): T {
131
- if (_severity[level] < _severity[_logLevel]) {
135
+ const _severity: Record<LogLevel, number> = {error: 3, warn: 2, info: 1, debug: 0};
136
+
137
+ if (_severity[level] < _severity[getLogLevel()]) {
132
138
  return fn?.();
133
139
  }
134
140
 
@@ -208,6 +214,5 @@ function parseSource(source: LogSource): string {
208
214
  // Initialize during parsing to make available immediately.
209
215
  //----------------------------------------------------------------
210
216
  let _logLevel: LogLevel = 'info';
211
- const _severity: Record<LogLevel, number> = {error: 3, warn: 2, info: 1, debug: 0};
212
217
 
213
218
  setLogLevel(store.session.get('xhLogLevel', 'info'));