-
Notifications
You must be signed in to change notification settings - Fork 29
refactor: improve logging in console for macaron commands #1160
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (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. |
3d7155e
to
408075b
Compare
185bc5d
to
3b04952
Compare
71c1b06
to
3cff491
Compare
@Demolus13 Please add |
3cff491
to
930fa41
Compare
dd959c9
to
4743d6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the new --disable-rich-output
command to the Sphinx docs:
|
||
def perform_action(action_args: argparse.Namespace) -> None: | ||
"""Perform the indicated action of Macaron.""" | ||
rich_handler = access_handler.get_handler() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment above this line to explain what the access_handler.get_handler()
does and why it should be called here.
src/macaron/build_spec_generator/reproducible_central/reproducible_central.py
Outdated
Show resolved
Hide resolved
src/macaron/build_spec_generator/reproducible_central/reproducible_central.py
Outdated
Show resolved
Hide resolved
|
||
vsa_table.add_row( | ||
"[bold blue]Verification Summary Attestation[/]", | ||
self.verification_summary_attestation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add the following to helps users decode the VSA:
To decode and inspect the payload, run cat output/vsa.intoto.jsonl | jq -r '.payload' | base64 -d | jq
.
src/macaron/console.py
Outdated
|
||
layout = layout + [ | ||
vsa_table, | ||
" cat output/vsa.intoto.jsonl | jq -r [white]'.payload'[/] | base64 -d | jq", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output/vsa.intoto.jsonl
directory should not be hardcoded, and instead read from vsa_path
. It would also be nicer to have a row where the first column is something like Decode and Inspect the Content:
.
src/macaron/__main__.py
Outdated
|
||
result = run_policy_engine(verify_policy_args.database, policy_content) | ||
vsa = generate_vsa(policy_content=policy_content, policy_result=result) | ||
# To get the console handler which was set earlier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# To get the console handler which was set earlier | |
# Retrieve the console handler previously configured via the access_handler. | |
# This handler is used to format and display output in the console using the | |
# 'rich' library for enhanced styling and readability. |
I think the rest of the # To get the console handler which was set earlier
comments can be removed as they are redundant.
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>
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>
53f7c8f
to
6dcb72d
Compare
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.
This PR introduces a custom logger built using Rich UI components and the RichHandler to visually enhance terminal logging. The logger can be imported and used across the codebase, offering function calls that allow modification of what is displayed in the terminal. Whenever data is updated through any of these function calls, the
make_layout()
function inconsole.py
is triggered to rebuild the layout. This function runs every 0.1 seconds, ensuring the terminal display is continuously refreshed to reflect the latest state of the application.Description of changes
--disable-rich-output
to fall back to standard logging formats.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 foranalyze
command.src/macaron/policy_engine/policy_engine.py
: logging refinements forverify-policy
command.src/macaron/repo_finder/repo_finder.py
: logging refinements forfind-source
command.src/macaron/config/defaults.py
: logging refinements fordump-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
Checklist
verified
label should appear next to all of your commits on GitHub.