Skip to content

Commit

Permalink
Use logging facade for logging abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerstolzenberg committed Mar 16, 2024
1 parent abdafa6 commit e4a15a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/app/logging/logging.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ import { NGXLogger } from 'ngx-logger';
export class LoggingService {
constructor(private readonly log: NGXLogger) {
}

trace(message?: string, ...additions: unknown[]) {
this.log.trace(message, additions);
}

debug(message?: string, ...additions: unknown[]) {
this.log.trace(message, additions);
}
}
4 changes: 2 additions & 2 deletions src/app/map/map.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ElementRef, EventEmitter, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { NGXLogger } from 'ngx-logger';
import {
CAPITOLS_LAYER,
DEFAULT_TRANSITION_DURATION_MS,
Expand All @@ -18,6 +17,7 @@ import { GeoBoundingBox, TileLayer } from '@deck.gl/geo-layers/typed';
import { environment } from '../../environments/environment';
import { DeckMetrics } from '@deck.gl/core/typed/lib/deck';
import { GeoService } from './geo.service';
import { LoggingService } from '../logging/logging.service';

@Injectable()
export class MapService {
Expand All @@ -34,7 +34,7 @@ export class MapService {

constructor(
private readonly http: HttpClient,
private readonly log: NGXLogger,
private readonly log: LoggingService,
private readonly geoService: GeoService,
private readonly notificationService: NotificationService
) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/notifications/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export class NotificationService {
}

showInfoLocalized(messageKey: string, ...additional: unknown[]) {
this.log.info(messageKey, additional);

firstValueFrom(this.i18nService.translateMultiple(['notifications.info-title', messageKey])).then(values =>
this.toastrService.info(values[1] + ' ' + additional, values[0], options)
firstValueFrom(this.i18nService.translateMultiple(['notifications.info-title', messageKey])).then(values => {
this.log.info(values[1], additional);
this.toastrService.info(values[1] + ' ' + additional, values[0], options);
}
);
}
}

0 comments on commit e4a15a9

Please sign in to comment.