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

main: silence all logrus logging for now #111

Merged
merged 1 commit into from
Jan 30, 2025
Merged

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Jan 30, 2025

This commit silences logrus logging for now by just dicarding everything from it. The rational is that the underlying libraries produce a lot of output, e.g. every build currently results in

$ image-builder build qcow2
WARN[0000] Failed to load consumer certs: no consumer key found
...

which is confusing to our users. What is worse is that containers also uses logrus so we can get random warnings without context from there too. Until we have a way to filter log messages this seems to be the most practical way.

We can add --verbose or --debug later to enable these kinds of messages.

This commit silences logrus logging for now by just dicarding
everything from it. The rational is that the underlying libraries
produce a lot of output, e.g. every build currently results in
```console
$ image-builder build qcow2
WARN[0000] Failed to load consumer certs: no consumer key found
...
```
which is confusing to our users. What is worse is that containers
also uses logrus so we can get random warnings without context
from there too. Until we have a way to filter log messages this
seems to be the most practical way.

We can add `--verbose` or `--debug` later to enable these kinds
of messages.
@mvo5 mvo5 requested a review from supakeen January 30, 2025 14:11
Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

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

Agreed; I'll open a ticket to track a --verbose (or multiple -v's).

@lzap
Copy link

lzap commented Jan 30, 2025

This is fine, I plan to refactor composer/images to make use of the stdlib log/slog but that is the same story and a similar solution.

Alternatively you can grab my ring buffer writer implementation from a different project and use it here storing last N lines, when error occurs you can pickup the data from the ring buffer and display it.

tw := NewTailWriter(2<<10)
logrus.SetOutput(tw)

// ... when error occurs

println(tw.LastLines(20))

@mvo5 mvo5 added this pull request to the merge queue Jan 30, 2025
Merged via the queue into osbuild:main with commit c590c38 Jan 30, 2025
28 checks passed
@mvo5 mvo5 deleted the drop-logrus-output branch January 30, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants