Skip to content

Commit 258c2f1

Browse files
committed
fix logger
1 parent fdc71e1 commit 258c2f1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/unstructured_client/utils/_human_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> operations.PartitionResponse
9595

9696
def log_retries(retry_count, sleep):
9797
"""Function for logging retries to give users visibility into requests."""
98-
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
99-
logging.info(
100-
"Retry attempt %s. Sleeping %s seconds before retry.", retry_count, round(sleep, 1)
98+
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s', stream=sys.stdout)
99+
logger = logging.getLogger('unstructured-client')
100+
logger.setLevel(logging.INFO)
101+
logger.info(
102+
"Retry attempt #%s. Sleeping %s seconds before retry.", retry_count, round(sleep, 1)
101103
)

src/unstructured_client/utils/retries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ def retry_with_backoff(func, initial_interval=500, max_interval=60000, exponent=
118118
exponent**retries + random.uniform(0, 1))
119119
if sleep > max_interval/1000:
120120
sleep = max_interval/1000
121-
log_retries(retry_count=retries, sleep=sleep) # human code
121+
log_retries(retry_count=retries+1, sleep=sleep) # human code
122122
time.sleep(sleep)
123123
retries += 1

0 commit comments

Comments
 (0)