generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 66
feat: Add logging util and CLI params for logging output #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mkmeral
wants to merge
6
commits into
strands-agents:main
Choose a base branch
from
mkmeral:logging-utils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awsarron
requested changes
May 25, 2025
|
Thanks for your contribution @mkmeral! I added a few comments to follow up on. |
✅ Fixed Issues: - Updated documentation from 'Strands CLI' to 'Strands Agent Builder' - Removed shebang from utility module - Enhanced logging behavior: stderr support when only --log-level provided - Fixed logger usage: using module logger for startup messages - Optimized logger configuration: simplified to parent loggers only - Removed unused functions: get_logging_status() and set_log_level_for_module() 🚀 Improvements: - Better UX: --log-level DEBUG works without --log-file (logs to stderr) - Fallback handling: auto-fallback to stderr if file creation fails - Enhanced CLI args: improved help text and argument behavior - Comprehensive test suite: 9 unit tests covering all scenarios 📝 New Logging Behavior: - No args = no logging (clean output) - --log-level only = logs to stderr - --log-file only = logs to file (INFO level) - Both args = logs to file with specified level All tests pass ✅
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds logging system to the Strands CLI. The implementation includes:
Command-line arguments for configuring logging:
--log-level: Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)--log-file: Specify output file path for logsA new utility module
logging_utils.pywith functions for:Integration into the main CLI entry point to initialize logging based on user preferences
Comprehensive unit tests in
tests/utils/test_logging_utils.pycovering:This enhancement will help users debug issues, track agent behavior, and maintain operation logs for production deployments.
Related Issues
[No specific issue reference provided - please add if applicable]
Documentation PR
[Link to associated documentation PR when created]
Type of Change
Testing
The changes have been thoroughly tested with:
hatch fmt --linter- All linting checks passhatch fmt --formatter- Code formatting is consistenthatch test --all- Full test suite passesAdditionally, manual testing with various logging configurations confirms the functionality:
See example
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice