@osovitny/anatoly 3.21.35 → 3.21.37
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.
|
@@ -316,8 +316,20 @@ class LoggingService {
|
|
|
316
316
|
static { this.packagePrefix = '@osovitny/anatoly'; }
|
|
317
317
|
constructor() {
|
|
318
318
|
}
|
|
319
|
-
static
|
|
320
|
-
|
|
319
|
+
static getMessage(info) {
|
|
320
|
+
if (typeof info !== 'string') {
|
|
321
|
+
return LoggingService.packagePrefix;
|
|
322
|
+
}
|
|
323
|
+
if (info.indexOf(LoggingService.packagePrefix) === 0) {
|
|
324
|
+
return info;
|
|
325
|
+
}
|
|
326
|
+
return `${LoggingService.packagePrefix}: ${info}`;
|
|
327
|
+
}
|
|
328
|
+
static getOptionalParams(info, optionalParams) {
|
|
329
|
+
if (typeof info === 'string') {
|
|
330
|
+
return optionalParams;
|
|
331
|
+
}
|
|
332
|
+
return [info, ...optionalParams];
|
|
321
333
|
}
|
|
322
334
|
static getConfiguredLogLevel() {
|
|
323
335
|
const appCoreSettings = AppCoreSettings;
|
|
@@ -327,18 +339,17 @@ class LoggingService {
|
|
|
327
339
|
?? appCoreSettings?.logging?.default
|
|
328
340
|
?? appCoreSettings?.logging?.Default
|
|
329
341
|
?? appCoreSettings?.diagnostics?.logLevel
|
|
330
|
-
?? appCoreSettings?.logLevel
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
static getMsalLogLevel() {
|
|
335
|
-
try {
|
|
336
|
-
const json = sessionStorage.getItem(SessionStorageKeys.appMSALSettings);
|
|
337
|
-
return json ? JSON.parse(json)?.app?.system?.loggerOptions?.logLevel : null;
|
|
338
|
-
}
|
|
339
|
-
catch {
|
|
340
|
-
return null;
|
|
342
|
+
?? appCoreSettings?.logLevel;
|
|
343
|
+
if (configuredValue !== null && typeof configuredValue !== 'undefined') {
|
|
344
|
+
return LoggingService.toLogLevel(configuredValue);
|
|
341
345
|
}
|
|
346
|
+
return LoggingService.isDevMode(appCoreSettings)
|
|
347
|
+
? AnatolyLogLevel.Verbose
|
|
348
|
+
: AnatolyLogLevel.Off;
|
|
349
|
+
}
|
|
350
|
+
static isDevMode(appCoreSettings) {
|
|
351
|
+
const value = appCoreSettings?.isDevMode ?? appCoreSettings?.IsDevMode;
|
|
352
|
+
return value === true || `${value}`.toLowerCase() === 'true';
|
|
342
353
|
}
|
|
343
354
|
static toLogLevel(value) {
|
|
344
355
|
if (value === null || typeof value === 'undefined') {
|
|
@@ -374,22 +385,22 @@ class LoggingService {
|
|
|
374
385
|
}
|
|
375
386
|
static debug(info, ...optionalParams) {
|
|
376
387
|
if (LoggingService.shouldLog(AnatolyLogLevel.Verbose)) {
|
|
377
|
-
console.debug(info, ...optionalParams);
|
|
388
|
+
console.debug(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
378
389
|
}
|
|
379
390
|
}
|
|
380
391
|
static info(info, ...optionalParams) {
|
|
381
392
|
if (LoggingService.shouldLog(AnatolyLogLevel.Info)) {
|
|
382
|
-
console.info(info, ...optionalParams);
|
|
393
|
+
console.info(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
383
394
|
}
|
|
384
395
|
}
|
|
385
396
|
static warn(info, ...optionalParams) {
|
|
386
397
|
if (LoggingService.shouldLog(AnatolyLogLevel.Warning)) {
|
|
387
|
-
console.warn(info, ...optionalParams);
|
|
398
|
+
console.warn(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
388
399
|
}
|
|
389
400
|
}
|
|
390
401
|
static error(error, ...optionalParams) {
|
|
391
402
|
if (LoggingService.shouldLog(AnatolyLogLevel.Error)) {
|
|
392
|
-
console.error(error, ...optionalParams);
|
|
403
|
+
console.error(LoggingService.getMessage(error), ...LoggingService.getOptionalParams(error, optionalParams));
|
|
393
404
|
}
|
|
394
405
|
}
|
|
395
406
|
debug(info, ...optionalParams) {
|
|
@@ -404,9 +415,6 @@ class LoggingService {
|
|
|
404
415
|
error(error, ...optionalParams) {
|
|
405
416
|
LoggingService.error(error, ...optionalParams);
|
|
406
417
|
}
|
|
407
|
-
getEventName(eventName) {
|
|
408
|
-
return LoggingService.getEventName(eventName);
|
|
409
|
-
}
|
|
410
418
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: LoggingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
411
419
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: LoggingService, providedIn: "root" }); }
|
|
412
420
|
}
|
|
@@ -2679,7 +2687,6 @@ class AnatolyHttpInterceptor {
|
|
|
2679
2687
|
}
|
|
2680
2688
|
//4. getCurrentContext
|
|
2681
2689
|
if (lowerCaseUrl.indexOf('getcurrentcontext') > -1) {
|
|
2682
|
-
// Only checks MSAL's current active account. It does not start login or token acquisition by itself; it only decides whether this request should call getAccessToken() at all.
|
|
2683
2690
|
authorizationTokenRequired = this.authService.isUserAuthenticated();
|
|
2684
2691
|
}
|
|
2685
2692
|
// Change Url if need it -------------------------------------------->
|
|
@@ -2740,13 +2747,13 @@ class AnatolyHttpInterceptor {
|
|
|
2740
2747
|
//Events
|
|
2741
2748
|
onRequestStart(loadingRequired, url) {
|
|
2742
2749
|
if (loadingRequired) {
|
|
2743
|
-
this.logger.info(
|
|
2750
|
+
this.logger.info('Loading show', url);
|
|
2744
2751
|
this.loadingService.show();
|
|
2745
2752
|
}
|
|
2746
2753
|
}
|
|
2747
2754
|
onRequestEnd(loadingRequired, url) {
|
|
2748
2755
|
if (loadingRequired) {
|
|
2749
|
-
this.logger.info(
|
|
2756
|
+
this.logger.info('Loading hide', url);
|
|
2750
2757
|
this.loadingService.hide();
|
|
2751
2758
|
}
|
|
2752
2759
|
}
|