When logging to the console, we should use stderr
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 835
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
From Bandit Launchpad blueprints:
https://blueprints.launchpad.net/bandit/+spec/log-to-stderr
As noted on https://review.openstack.org/#/c/167522/1/bandit/bandit.py, when we're logging to the console, we should choose to log to stderr instead of stdout. This allows users to collect the logging separately from the generated output. In the case of the review, when generating logs and formatting the output as JSON, we likely still want logging information but we don't want it breaking the JSON format. In this case if we defaulted to logging to stderr (instead of stdout), the tool could still be used like so:
$ bandit -f json src/ > output.json
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bandit/bandit.py, referenced by the issue's review link, and trace how console logging and formatted output are handled. Test the documented bandit -f json src/ > output.json usage, checking that logging is separated from generated JSON. Done means console logs no longer corrupt redirected JSON output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100