Use consistent string formatting in logging statements throughout the codebase. Prefer `%` style placeholders over f-strings or `.format()` in logging calls as this is more efficient when logs are filtered by level (placeholders are only evaluated if the log is actually emitted).
Use consistent string formatting in logging statements throughout the codebase. Prefer %
style placeholders over f-strings or .format()
in logging calls as this is more efficient when logs are filtered by level (placeholders are only evaluated if the log is actually emitted).
For good logging practices:
logging.info(‘%s benchmark running.’, operation_type)
logging.error(‘No models found in S3 bucket: {}’.format(bucket_name)) logging.warning(f’Failed to process {item_name}’) # Avoid f-strings in logging
2. Reduce duplicate logging logic:
```python
# Instead of:
if opt.train:
logging.info('%s training benchmark.', cell)
else:
logging.info('%s inference benchmark.', cell)
# Prefer:
mode = 'training' if opt.train else 'inference'
logging.info('%s %s benchmark.', cell, mode)
logging.error()
for failures that prevent normal operationlogging.warning()
for potential issues that don’t stop executionEnter the URL of a public GitHub repository