Skip to content

Commit

Permalink
Apply formatting to num seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
aguinane committed Aug 15, 2024
1 parent e2482a6 commit a22743d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tenacity/before_sleep.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def before_sleep_log(
logger: "logging.Logger",
log_level: int,
exc_info: bool = False,
sec_format: str = "%.3g",
) -> typing.Callable[["RetryCallState"], None]:
"""Before call strategy that logs to some logger the attempt."""

Expand Down Expand Up @@ -65,7 +66,7 @@ def log_it(retry_state: "RetryCallState") -> None:
logger.log(
log_level,
f"Retrying {fn_name} "
f"in {retry_state.next_action.sleep} seconds as it {verb} {value}.",
f"in {sec_format % retry_state.next_action.sleep} seconds as it {verb} {value}.",
exc_info=local_exc_info,
)

Expand Down

0 comments on commit a22743d

Please sign in to comment.