Skip to content

Commit

Permalink
Add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
oysand committed Jun 24, 2024
1 parent a88ae58 commit d0a542b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/api/Services/RobotService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public async Task<Robot> UpdateRobotBatteryLevel(string robotId, float batteryLe
var robotQuery = context.Robots.Where(robot => robot.Id == robotId).Include(robot => robot.CurrentInstallation);
var robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
logger.LogInformation("UpdateRobotBatteryLevel pre update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot!.Name, robot.Status, robot.CurrentArea?.Name);

await VerifyThatUserIsAuthorizedToUpdateDataForInstallation(robot!.CurrentInstallation);

Expand All @@ -166,6 +167,7 @@ public async Task<Robot> UpdateRobotBatteryLevel(string robotId, float batteryLe
robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
NotifySignalROfUpdatedRobot(robot!, robot!.CurrentInstallation!);
logger.LogInformation("UpdateRobotBatteryLevel post update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot.Name, robot.Status, robot.CurrentArea?.Name);

return robot;
}
Expand All @@ -175,6 +177,7 @@ public async Task<Robot> UpdateRobotPressureLevel(string robotId, float? pressur
var robotQuery = context.Robots.Where(robot => robot.Id == robotId).Include(robot => robot.CurrentInstallation);
var robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
logger.LogInformation("UpdateRobotPressureLevel pre update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot!.Name, robot.Status, robot.CurrentArea?.Name);

await VerifyThatUserIsAuthorizedToUpdateDataForInstallation(robot!.CurrentInstallation);

Expand All @@ -183,6 +186,7 @@ public async Task<Robot> UpdateRobotPressureLevel(string robotId, float? pressur
robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
NotifySignalROfUpdatedRobot(robot!, robot!.CurrentInstallation!);
logger.LogInformation("UpdateRobotPressureLevel post update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot.Name, robot.Status, robot.CurrentArea?.Name);

return robot;
}
Expand Down Expand Up @@ -230,6 +234,8 @@ public async Task<Robot> UpdateRobotIsarConnected(string robotId, bool isarConne
var robotQuery = context.Robots.Where(robot => robot.Id == robotId).Include(robot => robot.CurrentInstallation);
var robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
logger.LogInformation("UpdateRobotIsarConnected pre update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot!.Name, robot.Status, robot.CurrentArea?.Name);


await VerifyThatUserIsAuthorizedToUpdateDataForInstallation(robot!.CurrentInstallation);

Expand All @@ -238,6 +244,7 @@ public async Task<Robot> UpdateRobotIsarConnected(string robotId, bool isarConne
robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
NotifySignalROfUpdatedRobot(robot!, robot!.CurrentInstallation!);
logger.LogInformation("UpdateRobotIsarConnected post update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot.Name, robot.Status, robot.CurrentArea?.Name);

return robot;
}
Expand All @@ -247,6 +254,8 @@ public async Task<Robot> UpdateCurrentMissionId(string robotId, string? currentM
var robotQuery = context.Robots.Where(robot => robot.Id == robotId).Include(robot => robot.CurrentInstallation);
var robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
logger.LogInformation("UpdateCurrentMissionId pre update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot!.Name, robot.Status, robot.CurrentArea?.Name);


await VerifyThatUserIsAuthorizedToUpdateDataForInstallation(robot!.CurrentInstallation);

Expand All @@ -255,6 +264,7 @@ public async Task<Robot> UpdateCurrentMissionId(string robotId, string? currentM
robot = await robotQuery.FirstOrDefaultAsync();
ThrowIfRobotIsNull(robot, robotId);
NotifySignalROfUpdatedRobot(robot!, robot!.CurrentInstallation!);
logger.LogInformation("UpdateCurrentMissionId post update: Robot {robotName} has status {robotStatus} and current area {areaName}", robot.Name, robot.Status, robot.CurrentArea?.Name);

return robot;
}
Expand Down

0 comments on commit d0a542b

Please sign in to comment.