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

Finer grained logging #129

Merged
merged 2 commits into from
Dec 30, 2023
Merged

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Dec 23, 2023

Needs #128 to be merged first.

This PR moves snare to a more fine-grained logging framework, and then makes use of that finer-grained logging to avoid bombarding the user with irrelevant stuff in the common case. For example, before this PR, invalid HTTP requests (caused, almost certainly, by spammers) generated logging, which isn't very useful. After this PR one only sees that if -vvvv is specified. At the default level of verbosity, however, more genuine errors (e.g. requests that don't authenticate) are logged.

@ltratt
Copy link
Member Author

ltratt commented Dec 25, 2023

OK for me to rebase?

snare previously had a simple notion of logging: either it's an error,
and reported, or it isn't. This commit paves the way for a finer-grained
notion of logging. Adds a `-v` switch (which can be repeated for greater
levels of verbosity).
Some of the logging information in snare tells the user they've
misconfigured snare or GitHub, but some logging information is really
meant to help someone debug a change in GitHub requests. This commit
teases those two out. By making HTTP request functions take `TcpStream`
(i.e. moving it) the terminal part of this function is now a little
harder to misuse, and also allows us to restore more informative HTTP
return codes (e.g. "unauthorised").
@vext01
Copy link
Member

vext01 commented Dec 27, 2023

Go ahead.

@ltratt ltratt force-pushed the finer_grained_logging branch from f8e47be to 119a176 Compare December 27, 2023 18:06
@ltratt
Copy link
Member Author

ltratt commented Dec 27, 2023

Squashed.

@vext01 vext01 added this pull request to the merge queue Dec 30, 2023
Merged via the queue into softdevteam:master with commit 51cc2fd Dec 30, 2023
2 checks passed
@ltratt ltratt deleted the finer_grained_logging branch April 2, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants