Skip to content

Conversation

Demolus13
Copy link
Member

@Demolus13 Demolus13 commented Aug 25, 2025

Summary

Refactor console logging to provide a clearer, more user‑friendly command output with an optional Rich UI output, while keeping detailed logs. Adds a flag to disable Rich output for default plain text UI.

Description of changes

  • Introduces a Rich-based logging handler and integrated it into the macaron commands so users see concise, structured progress and results in the terminal.
  • Adds a new CLI flag --disable-rich-output to fall back to standard logging formats.
  • Improves consistency of log message formatting and argument handling across modules through verbose mode.
  • Using Rich Handler to provide a custom logger with rich output to python logging.
  • Providing various functions and API calls to update the contents shown on running macaron commands.
  • Creating AccessHandler to set logger with verbosity and get logger.
  • No functional behaviour changes to analysis/policy evaluation

Modified files

  • src/macaron/__main__.py: core logging setup, CLI flag, command dispatch hooks into Rich handler.
  • src/macaron/console.py: adds/accesses the Rich logging handler module.
  • src/macaron/slsa_analyzer/analyzer.py: logging refinements for analyze command.
  • src/macaron/policy_engine/policy_engine.py: logging refinements for verify-policy command.
  • src/macaron/repo_finder/repo_finder.py: logging refinements for find-source command.
  • src/macaron/config/defaults.py: logging refinements for dump-defaults command.
  • src/macaron/output_reporter/reporter.py: small logging/formatting tweaks.
  • src/macaron/policy_engine/results.py: small logging/formatting tweaks.
  • src/macaron/repo_finder/repo_utils.py: small logging/formatting tweaks.
  • src/macaron/policy_engine/base_check.py: log formatting consistency.
  • src/macaron/policy_engine/registry.py: log formatting consistency.

Related issues

  • Command Line Interface #211

Checklist

  • I have reviewed the contribution guide.
  • My PR title and commits follow the Conventional Commits convention.
  • My commits include the "Signed-off-by" line.
  • I have signed my commits following the instructions provided by GitHub. Note that we run GitHub's commit verification tool to check the commit signatures. A green verified label should appear next to all of your commits on GitHub.
  • I have updated the relevant documentation, if applicable.
  • I have tested my changes and verified they work as expected.

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Aug 25, 2025
@Demolus13 Demolus13 force-pushed the pgovale/ui-enhancements branch 2 times, most recently from 3d7155e to 408075b Compare August 26, 2025 10:27
@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Aug 26, 2025
@Demolus13 Demolus13 force-pushed the pgovale/ui-enhancements branch from 185bc5d to 3b04952 Compare September 16, 2025 08:14
@Demolus13 Demolus13 self-assigned this Sep 25, 2025
@Demolus13 Demolus13 force-pushed the pgovale/ui-enhancements branch from 71c1b06 to 3cff491 Compare September 26, 2025 05:43
@behnazh-w
Copy link
Member

@Demolus13 Please add rich as a direct dependency to pyproject.toml.

self.rich_handler = RichConsoleHandler()

def set_handler(self, verbose: bool) -> RichConsoleHandler:
"""Set the verbosity and create a new RichConsoleHandler instance."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to include Parameters, Returns, and if needed Raises for exceptions in the docstrings. This comment applies to all the docstrings.

See our contribution guideline here: https://oracle.github.io/macaron/pages/developers_guide/style_guide.html#docstrings

@Demolus13 Demolus13 force-pushed the pgovale/ui-enhancements branch from 3cff491 to 930fa41 Compare September 29, 2025 11:15
pyproject.toml Outdated
"cryptography >=44.0.0,<45.0.0",
"semgrep == 1.113.0",
"email-validator >=2.2.0,<3.0.0",
"rich ~= 13.5",
Copy link
Member

@behnazh-w behnazh-w Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"rich ~= 13.5",
"rich >=13.5.3,<15.0.0",

Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
Signed-off-by: Demolus13 <parth.govale@oracle.com>
@Demolus13 Demolus13 force-pushed the pgovale/ui-enhancements branch from dd959c9 to 4743d6d Compare October 3, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants