| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
The Strands Agents style guide aims to establish consistent formatting, naming conventions, and structure across all code in the repository. We strive to make our code clean, readable, and maintainable.
Where possible, we will codify these style guidelines into our linting rules and pre-commit hooks to automate enforcement and reduce the manual review burden.
The format for Strands Agents logs is as follows:
logger.debug("field1=<%s>, field2=<%s>, ... | human readable message", field1, field2, ...)Context:
Messages:
logger.debug("user_id=<%s>, action=<%s> | user performed action", user_id, action)
logger.info("request_id=<%s>, duration_ms=<%d> | request completed", request_id, duration)
logger.warning("attempt=<%d>, max_attempts=<%d> | retry limit approaching", attempt, max_attempts)# Avoid: No structured fields, direct variable interpolation in message
logger.debug(f"User {user_id} performed action {action}")
# Avoid: Inconsistent formatting, punctuation
logger.info("Request completed in %d ms.", duration)
# Avoid: No separation between fields and message
logger.warning("Retry limit approaching! attempt=%d max_attempts=%d", attempt, max_attempts)By following these log formatting guidelines, we ensure that logs are both human-readable and machine-parseable, making debugging and monitoring more efficient.
| Back | FazBrowse Home | New Git URL |