@osovitny/anatoly 3.21.35 → 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.
@@ -316,8 +316,20 @@ class LoggingService {
316
316
  static { this.packagePrefix = '@osovitny/anatoly'; }
317
317
  constructor() {
318
318
  }
319
- static getEventName(eventName) {
320
- return `${LoggingService.packagePrefix}.${eventName}`;
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;
@@ -374,22 +386,22 @@ class LoggingService {
374
386
  }
375
387
  static debug(info, ...optionalParams) {
376
388
  if (LoggingService.shouldLog(AnatolyLogLevel.Verbose)) {
377
- console.debug(info, ...optionalParams);
389
+ console.debug(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
378
390
  }
379
391
  }
380
392
  static info(info, ...optionalParams) {
381
393
  if (LoggingService.shouldLog(AnatolyLogLevel.Info)) {
382
- console.info(info, ...optionalParams);
394
+ console.info(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
383
395
  }
384
396
  }
385
397
  static warn(info, ...optionalParams) {
386
398
  if (LoggingService.shouldLog(AnatolyLogLevel.Warning)) {
387
- console.warn(info, ...optionalParams);
399
+ console.warn(LoggingService.getMessage(info), ...LoggingService.getOptionalParams(info, optionalParams));
388
400
  }
389
401
  }
390
402
  static error(error, ...optionalParams) {
391
403
  if (LoggingService.shouldLog(AnatolyLogLevel.Error)) {
392
- console.error(error, ...optionalParams);
404
+ console.error(LoggingService.getMessage(error), ...LoggingService.getOptionalParams(error, optionalParams));
393
405
  }
394
406
  }
395
407
  debug(info, ...optionalParams) {
@@ -404,9 +416,6 @@ class LoggingService {
404
416
  error(error, ...optionalParams) {
405
417
  LoggingService.error(error, ...optionalParams);
406
418
  }
407
- getEventName(eventName) {
408
- return LoggingService.getEventName(eventName);
409
- }
410
419
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: LoggingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
411
420
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: LoggingService, providedIn: "root" }); }
412
421
  }
@@ -2740,13 +2749,13 @@ class AnatolyHttpInterceptor {
2740
2749
  //Events
2741
2750
  onRequestStart(loadingRequired, url) {
2742
2751
  if (loadingRequired) {
2743
- this.logger.info(this.logger.getEventName('loading.show'), url);
2752
+ this.logger.info('Loading show', url);
2744
2753
  this.loadingService.show();
2745
2754
  }
2746
2755
  }
2747
2756
  onRequestEnd(loadingRequired, url) {
2748
2757
  if (loadingRequired) {
2749
- this.logger.info(this.logger.getEventName('loading.hide'), url);
2758
+ this.logger.info('Loading hide', url);
2750
2759
  this.loadingService.hide();
2751
2760
  }
2752
2761
  }