Closed rgreinho closed 2 years ago
@rgreinho Thanks again for your contributions! So just to clarify, your suggestion is to remove the full error message from the printer when we get an error?
Oh no, not at all. I was actually vouching for a more gradual approach to display the errors, possibly adding some context to resolve the issue.
For instance, the line:
2022-06-17 09:10:08 ERR error in fetching organization hooks error="GET https://api.github.com/orgs/buildsec/hooks: 404 Not Found []"
Could become:
2022-06-17 09:10:08 ERR error in fetching organization hooks"
2022-06-17 09:10:08 ERR check token permission: require the admin:org_hook scope (https://docs.github.com/en/rest/orgs/webhooks#scopes-and-restrictions=)"
2022-06-17 09:10:08 DEBUG organization hooks error="GET https://api.github.com/orgs/buildsec/hooks: 404 Not Found []"
Where the ERR level would provide the error description, a potential resolution, and the DEBUG level would provide more useful details for debugging if needed.
Regarding my remark about the CLI, I was advocating in favor of changing the behavior of the -v flag to use it to define the verbosity level. I don't have a Golang example handy, but the concept can be seen in this Rust project:
-v
provided on the command line (https://github.com/rgreinho/labelr-rs/blob/master/src/cli.rs#L8-L10=)I find this approach more ergonomic than using --log-level debug
, but I do realize that this may be a personal preference, and since the functionality is already there, it may not be that important actually.
Thanks Remy! @rgreinho
I like the idea of using the verbosity flag to determine the log level, it doesn't have much use on its own anyway.
I'm also thinking to use the quiet
flag as the opposite of verbose, to adjust the log level the other way.
Fix coming soon, with log adjustments as well.
By default the CLI shows a bunch of detailed errors:
But these errors just clutter the output, and are not very useful unless debugging information is needed. These types of details should be displayed for debug or tracing log level.
As a user I should be able to adjust the log level from the CLI, for example by supplying
-v
flags (1 for info, 2 for debug, 3 for trace).