Skip to content

Commit 9149cd4

Browse files
committed
Self review
1 parent 0d9d40f commit 9149cd4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ack_backend/src/logging_decorators.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ def generate_and_send_logs(
3131
"""Generates log data which includes the base_log_data, additional_log_data, and time taken (calculated using the
3232
current time and given start_time) and sends them to Cloudwatch and Firehose."""
3333
seconds_elapsed = time.time() - start_time
34-
time_elapsed = f"{round(seconds_elapsed * 1000, 5)}ms" if use_ms_precision else f"{round(seconds_elapsed, 5)}s"
34+
formatted_time_elapsed = f"{round(seconds_elapsed * 1000, 5)}ms" if use_ms_precision else \
35+
f"{round(seconds_elapsed, 5)}s"
3536

36-
log_data = {**base_log_data, "time_taken": time_elapsed, **additional_log_data}
37+
log_data = {**base_log_data, "time_taken": formatted_time_elapsed, **additional_log_data}
3738
log_function = logger.error if is_error_log else logger.info
3839
log_function(json.dumps(log_data))
3940
send_log_to_firehose(log_data)

0 commit comments

Comments
 (0)