(dc): change logging to json
This commit is contained in:
@@ -39,7 +39,7 @@ export class ManagerResolver {
|
||||
|
||||
@Subscription(() => TimePerTourUpdateObjectType)
|
||||
timePerTourUpdated() {
|
||||
return this.timePerTourKpiService.pubSub.asyncIterator(
|
||||
return this.timePerTourKpiService.pubSub.asyncIterableIterator(
|
||||
'timePerTourUpdated',
|
||||
);
|
||||
}
|
||||
|
||||
-1
@@ -92,7 +92,6 @@ export class TicketLifecycleService {
|
||||
|
||||
private async validateCreatedTickets(): Promise<void> {
|
||||
const tickets = await this.repository.findAllCreated();
|
||||
this.logger.debug(`Found ${tickets.length} with state CREATED`);
|
||||
|
||||
for (const ticket of tickets) {
|
||||
const {
|
||||
|
||||
@@ -362,7 +362,6 @@ export class TicketRepository {
|
||||
|
||||
const dwellTimesForTicketState = ticketWithState
|
||||
.map(({ state }) => {
|
||||
console.log(state);
|
||||
const stateToCalculateIdx = state.findIndex(
|
||||
({ state }) => state === ticketState,
|
||||
);
|
||||
|
||||
@@ -77,6 +77,6 @@ export class TicketsResolver {
|
||||
|
||||
@Subscription(() => TicketsUpdatedObjectType)
|
||||
ticketsUpdated() {
|
||||
return this.ticketsService.pubSub.asyncIterator('ticketsUpdated');
|
||||
return this.ticketsService.pubSub.asyncIterableIterator('ticketsUpdated');
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ export class DriverCertificateDetector extends AnomalyDetector {
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error, anomaly.id);
|
||||
this.logger.error(error, { anomalyId: anomaly.id });
|
||||
return anomaly;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-11
@@ -68,7 +68,7 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
|
||||
return anomaly;
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error, anomaly.id);
|
||||
this.logger.error(error, { anomalyId: anomaly.id });
|
||||
return anomaly;
|
||||
}
|
||||
}
|
||||
@@ -200,12 +200,11 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
|
||||
return false;
|
||||
}
|
||||
if (!employee.personnelNumber) {
|
||||
this.logger.warn(
|
||||
`Employee has no personnelNumber`,
|
||||
employee.id,
|
||||
employee.surname,
|
||||
employee.name,
|
||||
);
|
||||
this.logger.warn(`Employee has no personnelNumber`, {
|
||||
id: employee.id,
|
||||
surname: employee.surname,
|
||||
name: employee.name,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -313,13 +312,12 @@ export class EmployeesLoggedInDetector extends AnomalyDetector {
|
||||
return [false, undefined];
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
error,
|
||||
datetimeToCheck.toISOString(),
|
||||
this.logger.error(error, {
|
||||
timeInQuestion: datetimeToCheck.toISOString(),
|
||||
workTime,
|
||||
firstClockedIn,
|
||||
lastClockedOut,
|
||||
);
|
||||
});
|
||||
return [false, undefined];
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -131,12 +131,11 @@ export class OneTourAtATimeDetector extends AnomalyDetector {
|
||||
tourListInterval,
|
||||
);
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
'tourListInterval',
|
||||
error,
|
||||
this.logger.error(error, {
|
||||
what: 'tourListInterval',
|
||||
tourListInterval,
|
||||
tourInterval,
|
||||
);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -299,7 +298,7 @@ export class OneTourAtATimeDetector extends AnomalyDetector {
|
||||
}
|
||||
return { ...anomaly };
|
||||
} catch (error) {
|
||||
this.logger.error(error, anomaly.id);
|
||||
this.logger.error(error, { anomalyId: anomaly.id });
|
||||
return anomaly;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ export class WorkingEmployeeNotInDistributionSystemDetector extends AnomalyDetec
|
||||
} catch (error) {
|
||||
this.logger.warn(
|
||||
`Employee does not exist! PersonnelNumber: ${personnelNumber}`,
|
||||
error,
|
||||
{ error },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export class CalculationService {
|
||||
new Date(startDate),
|
||||
);
|
||||
if (!tariff) {
|
||||
this.logger.error(
|
||||
this.logger.warn(
|
||||
`No tariff found for tour ${tour.operationId} (${tour.healthInsurance})`,
|
||||
);
|
||||
return 0;
|
||||
@@ -163,11 +163,10 @@ export class CalculationService {
|
||||
),
|
||||
);
|
||||
if (!billingInformation) {
|
||||
this.logger.error(
|
||||
"Couldn't find billing information",
|
||||
this.logger.warn("Couldn't find billing information", {
|
||||
date: date.toISOString(),
|
||||
ordinanceType,
|
||||
date.toISOString(),
|
||||
);
|
||||
});
|
||||
throw new Error("Couldn't find billing information");
|
||||
}
|
||||
return billingInformation[1];
|
||||
|
||||
-1
@@ -12,7 +12,6 @@ export class PlannedTimeLoader {
|
||||
const deletedPlannedTimes = stagingPlannedTimes.filter(
|
||||
({ deleted }) => deleted,
|
||||
);
|
||||
console.log(deletedPlannedTimes.length);
|
||||
const plannedTimesToInsert = stagingPlannedTimes.filter(
|
||||
({ id }) =>
|
||||
!!id &&
|
||||
|
||||
Reference in New Issue
Block a user