diff --git a/lib/controllers/environment.py b/lib/controllers/environment.py index bb2b09b..40bd7bd 100644 --- a/lib/controllers/environment.py +++ b/lib/controllers/environment.py @@ -56,9 +56,14 @@ async def create_env(env: Env) -> Union[EnvCreated, HTTPException]: else: return EnvCreated(env_id=env_repo.env_id) finally: + env_id = ( + getattr(env_repo, 'env_id', 'unknown') + if env_repo + else 'unknown' + ) if env_repo: logger.info( - f"Call to controllers.environment.create_env completed for Env {env_repo.env_id}" + f"Call to controllers.environment.create_env completed for Env {env_id}" ) @staticmethod diff --git a/lib/controllers/flight.py b/lib/controllers/flight.py index 7aa7ad0..1d2aa8d 100644 --- a/lib/controllers/flight.py +++ b/lib/controllers/flight.py @@ -73,7 +73,11 @@ async def create_flight( else: return FlightCreated(flight_id=flight_repo.flight_id) finally: - flight_id = getattr(flight_repo, 'flight_id', 'unknown') if flight_repo else 'unknown' + flight_id = ( + getattr(flight_repo, 'flight_id', 'unknown') + if flight_repo + else 'unknown' + ) logger.info( f"Call to controllers.flight.create_flight completed for Flight {flight_id}" ) diff --git a/lib/controllers/motor.py b/lib/controllers/motor.py index 10fad67..824dfd1 100644 --- a/lib/controllers/motor.py +++ b/lib/controllers/motor.py @@ -69,9 +69,14 @@ async def create_motor( else: return MotorCreated(motor_id=motor_repo.motor_id) finally: + motor_id = ( + getattr(motor_repo, 'motor_id', 'unknown') + if motor_repo + else 'unknown' + ) if motor_repo: logger.info( - f"Call to controllers.motor.create_motor completed for Motor {motor_repo.motor_id}" + f"Call to controllers.motor.create_motor completed for Motor {motor_id}" ) @staticmethod diff --git a/lib/controllers/rocket.py b/lib/controllers/rocket.py index 4a7ad17..5b42b60 100644 --- a/lib/controllers/rocket.py +++ b/lib/controllers/rocket.py @@ -63,9 +63,14 @@ async def create_rocket( else: return RocketCreated(rocket_id=rocket_repo.rocket_id) finally: + rocket_id = ( + getattr(rocket_repo, 'rocket_id', 'unknown') + if rocket_repo + else 'unknown' + ) if rocket_repo: logger.info( - f"Call to controllers.rocket.create_rocket completed for Rocket {rocket_repo.rocket_id}" + f"Call to controllers.rocket.create_rocket completed for Rocket {rocket_id}" ) @staticmethod