Skip to content
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

Standardize and Improve Plugin Logs #1037

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

KirilldogU
Copy link
Contributor

@KirilldogU KirilldogU commented Mar 20, 2025

Resolves #915

Standardize and add to the plugin logs for consistency, clarity, and increased utility for debugging.

All plugin queries produce an INFO level log "running query_name query" at start and INFO level "completed query_name query" at successful resolution. The linguist plugin is an exception and it logs queries at the DEBUG level because it produces thousands of logs due to repeated is_source_file() calls.

All plugins which use the plugin engine to query other plugins also produce TRACE level logs at that point.

@KirilldogU KirilldogU force-pushed the kusubyan/plugin-begin-end-logs branch from df34d12 to b55cec9 Compare March 20, 2025 16:25
@KirilldogU
Copy link
Contributor Author

This PR adds INFO start/end logs to all the plugins except: npm, linguist, git, and github. Those plugins appear to be used by the other plugins during analysis and do not provide their own analysis metric so I chose to leave them without this INFO log.
Is this correct?

@alilleybrinker
Copy link
Collaborator

This PR adds INFO start/end logs to all the plugins except: npm, linguist, git, and github. Those plugins appear to be used by the other plugins during analysis and do not provide their own analysis metric so I chose to leave them without this INFO log. Is this correct?

I'd still add it. They're not "top-level" plugins (they don't expose a default query), but it can still be useful for debugging to know when they're running.

@j-lanson
Copy link
Collaborator

This PR adds INFO start/end logs to all the plugins except: npm, linguist, git, and github. Those plugins appear to be used by the other plugins during analysis and do not provide their own analysis metric so I chose to leave them without this INFO log. Is this correct?

I'd still add it. They're not "top-level" plugins (they don't expose a default query), but it can still be useful for debugging to know when they're running.

I agree with Andrew, the reason we did the work of adding parsing and per-plugin control through HC_LOG was so that people can turn off / reduce the log level of plugins as they wish. If they don't want a bunch of git plugin logs they can do HC_LOG=plugin::git=warn

@KirilldogU KirilldogU self-assigned this Mar 20, 2025
@KirilldogU KirilldogU marked this pull request as draft March 20, 2025 17:24
@KirilldogU KirilldogU force-pushed the kusubyan/plugin-begin-end-logs branch from b55cec9 to 1aa715d Compare March 20, 2025 19:44
@KirilldogU KirilldogU changed the title Standardize the INFO Start/End logs of single-metric plugins Standardize and Improve Plugin Logs Mar 20, 2025
@KirilldogU KirilldogU force-pushed the kusubyan/plugin-begin-end-logs branch from 1aa715d to c569aa6 Compare March 20, 2025 20:47
Signed-off-by: Kirill Usubyan <kusubyan@mitre.org>
@KirilldogU KirilldogU force-pushed the kusubyan/plugin-begin-end-logs branch from c569aa6 to f17ac19 Compare March 20, 2025 21:16
@KirilldogU KirilldogU requested a review from j-lanson March 20, 2025 21:20
@KirilldogU KirilldogU marked this pull request as ready for review March 20, 2025 21:21
Copy link
Collaborator

@j-lanson j-lanson left a comment

Choose a reason for hiding this comment

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

Looks good Kirill, thanks!

@alilleybrinker alilleybrinker added this pull request to the merge queue Mar 21, 2025
Merged via the queue into main with commit 1aef510 Mar 21, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Standardize Logging Across Plugins
3 participants