Skip to content

Commit

Permalink
fix(logging): log config _rev for error analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Mar 13, 2024
1 parent 6b6e078 commit a6e8669
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/core/database/sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { LoginStateSubject, SyncStateSubject } from "../session/session-type";
import { LoginState } from "../session/session-states/login-state.enum";
import { filter } from "rxjs/operators";
import { KeycloakAuthService } from "../session/auth/keycloak/keycloak-auth.service";
import { Config } from "../config/config";
import { Entity } from "../entity/model/entity";

/**
* This service initializes the remote DB and manages the sync between the local and remote DB.
Expand Down Expand Up @@ -44,11 +46,16 @@ export class SyncService {
});
}

private logSyncContext() {
private async logSyncContext() {
const lastSyncTime = localStorage.getItem(SyncService.LAST_SYNC_KEY);
const configRev = await this.database
.get(Entity.createPrefixedId(Config.ENTITY_TYPE, Config.CONFIG_KEY))
.catch(() => null)
.then((config) => config?._rev);

LoggingService.addContext("Aam Digital sync", {
"last sync completed": lastSyncTime,
"config _rev": configRev,
});
}

Expand Down

0 comments on commit a6e8669

Please sign in to comment.