feat: centralize logging and add --verbose, --debug, --log-file flags#86
Open
rthakkar0555 wants to merge 1 commit into
Open
feat: centralize logging and add --verbose, --debug, --log-file flags#86rthakkar0555 wants to merge 1 commit into
rthakkar0555 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
=======================================
Coverage ? 42.68%
=======================================
Files ? 17
Lines ? 1989
Branches ? 0
=======================================
Hits ? 849
Misses ? 1140
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Open
6 tasks
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
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.
Summary
Implements structured logging across the DockSec codebase, replacing
inconsistent print() and console.print() calls with Python's standard
logging module. Adds --verbose, --debug, and --log-file CLI flags
for configurable verbosity.
Closes #52
Problems Fixed
Changes Made
docksec/utils.pyconfigure_logging(verbose, debug, log_file)function--debug→ DEBUG,--verbose→ INFO, default → WARNING--log-fileadds a FileHandler alongside StreamHandlerget_custom_logger()preserved untoucheddocksec/cli.py-v/--verbose— show detailed scan progress--debug— surface raw subprocess output and tool stderr--log-file PATH— write structured logs to fileconfigure_logging()called immediately after args are parseddocksec/docker_scanner.pylogger.info()logger.debug()logger.error()logger.debug()docksec/score_calculator.pylogger.info()logger.debug()docksec/report_generator.pylogger.info()logger.warning()logger.error()tests/test_logging.py(new)Acceptance Criteria Met
Validation
pytest tests/ -v → 37 passed, 0 failures


(6 new logging tests + 31 existing tests, 0 regressions)