@osovitny/anatoly 3.21.34 → 3.21.36
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.
|
@@ -313,8 +313,24 @@ var AnatolyLogLevel;
|
|
|
313
313
|
AnatolyLogLevel[AnatolyLogLevel["Verbose"] = 3] = "Verbose";
|
|
314
314
|
})(AnatolyLogLevel || (AnatolyLogLevel = {}));
|
|
315
315
|
class LoggingService {
|
|
316
|
+
static { this.packagePrefix = '@osovitny/anatoly'; }
|
|
316
317
|
constructor() {
|
|
317
318
|
}
|
|
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];
|
|
333
|
+
}
|
|
318
334
|
static getConfiguredLogLevel() {
|
|
319
335
|
const appCoreSettings = AppCoreSettings;
|
|
320
336
|
const configuredValue = appCoreSettings?.logging?.logLevel?.default
|
|
@@ -370,22 +386,22 @@ class LoggingService {
|
|
|
370
386
|
}
|
|
371
387
|
static debug(info, ...optionalParams) {
|
|
372
388
|
if (LoggingService.shouldLog(AnatolyLogLevel.Verbose)) {
|
|
373
|
-
console.debug(info, ...optionalParams);
|
|
389
|
+
console.debug(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
374
390
|
}
|
|
375
391
|
}
|
|
376
392
|
static info(info, ...optionalParams) {
|
|
377
393
|
if (LoggingService.shouldLog(AnatolyLogLevel.Info)) {
|
|
378
|
-
console.info(info, ...optionalParams);
|
|
394
|
+
console.info(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
379
395
|
}
|
|
380
396
|
}
|
|
381
397
|
static warn(info, ...optionalParams) {
|
|
382
398
|
if (LoggingService.shouldLog(AnatolyLogLevel.Warning)) {
|
|
383
|
-
console.warn(info, ...optionalParams);
|
|
399
|
+
console.warn(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
|
|
384
400
|
}
|
|
385
401
|
}
|
|
386
402
|
static error(error, ...optionalParams) {
|
|
387
403
|
if (LoggingService.shouldLog(AnatolyLogLevel.Error)) {
|
|
388
|
-
console.error(error, ...optionalParams);
|
|
404
|
+
console.error(LoggingService.getMessage(error), ...LoggingService.getOptionalParams(error, optionalParams));
|
|
389
405
|
}
|
|
390
406
|
}
|
|
391
407
|
debug(info, ...optionalParams) {
|
|
@@ -2733,13 +2749,13 @@ class AnatolyHttpInterceptor {
|
|
|
2733
2749
|
//Events
|
|
2734
2750
|
onRequestStart(loadingRequired, url) {
|
|
2735
2751
|
if (loadingRequired) {
|
|
2736
|
-
this.logger.info('
|
|
2752
|
+
this.logger.info('Loading show', url);
|
|
2737
2753
|
this.loadingService.show();
|
|
2738
2754
|
}
|
|
2739
2755
|
}
|
|
2740
2756
|
onRequestEnd(loadingRequired, url) {
|
|
2741
2757
|
if (loadingRequired) {
|
|
2742
|
-
this.logger.info('
|
|
2758
|
+
this.logger.info('Loading hide', url);
|
|
2743
2759
|
this.loadingService.hide();
|
|
2744
2760
|
}
|
|
2745
2761
|
}
|