-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enable silent log-level for hiding INFO messages #1308
Conversation
Thanks, LGTM, but can we discuss if "silent" shouldn't be the default, and @AkihiroSuda WDYT? |
minikube saves all logging output to a file, unless you give an explicit option: For the regular progress output, it goes all in on emojis (unless you disable them). It divides the crowd. |
I always found this a bit unconventional; but I can see the advantage for something that runs a little longer (like
Personally I like the minikube emoji, but I understand that some people feel differently. I do find it challenging to pick meaningful emoji for some status messages though. |
As noted elsewhere, it also needs a fix for the URL that it is downloading (by default only showing progress bar)
The suggestion is to just print the URL on a separate line, maybe then log as debug (so that is not too redundant).
Changed it to not show the full url by default, only the base name (and description)
|
Added |
cmd/limactl/main.go
Outdated
silent, _ := cmd.Flags().GetBool("silent") | ||
if silent { | ||
logrus.SetLevel(logrus.WarnLevel) | ||
} |
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.
I agree with @jbergstroem that silent
should mean "no output", so the log level should be "Error" and not "Warn".
But if this option is just an alias for --log-level error
, then I would rather not have it at all. If we have it as a distinct option, then it also needs to suppress of progress bars, and the message output.
If it was just an alias, then I would rather have separate --debug
, --info
, --warn
, and --error
flags.
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.
It was just an alias, like the --debug. I guess that --quiet would have been better.
But I only needed a way to hide the log spam, a log file would also have worked...
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.
I guess that --quiet would have been better.
To me the issue is not (just) the name, but also that it is redundant. And it isn't even clear what it does: is --quiet
the same as --log-level warn
or --log-level error
?
Or does it something else, and should be combined with --log-level
because it really quiets down stuff that is not a log entry, like the download progress bars, or the message from lima.yaml
?
It was just an alias, like the --debug.
I would have objected to adding --debug
if we already had --log-level
, but now we want to keep it for backwards compatibility.
As I mentioned before, we should have either --trace
, --debug
, --info
, --warn
, and --error
options, or --log-level
, but not both. But even if we wanted to have both, why would the shortcut be called --quiet
or --silent
and not --warn
or --error
to make it clear what they do?
Just for the record, I prefer to have --log-level
over individual options, if for no other reason than to keep the --help
output tidy.
Having redundant options has a cost, especially to new users: they wonder what the differences are, and then have to look at the documentation. It also clutters up the --help
output:
--debug debug mode
--log-level string Set the logging level [trace, debug, info, warn, error, fatal, panic]
--silent silent mode
We now have 3 options just to set a log level, when 1 would be sufficient.
So unless --silent
/--quiet
provides additional functionality, I'm opposed to adding it.
Maybe this is a separate issue, but I would not expect this output:
$ limactl start --silent --tty=false template://docker > lima.log
31.66 MiB / 647.50 MiB (4.89%) ? p/s
68.80 MiB / 647.50 MiB (10.62%) 7.43 MiB/s
101.78 MiB / 647.50 MiB (15.72%) 7.37 MiB/s
139.12 MiB / 647.50 MiB (21.49%) 7.38 MiB/s
173.44 MiB / 647.50 MiB (26.79%) 7.35 MiB/s
209.23 MiB / 647.50 MiB (32.31%) 7.34 MiB/s
246.92 MiB / 647.50 MiB (38.13%) 7.35 MiB/s
282.62 MiB / 647.50 MiB (43.65%) 7.33 MiB/s
317.83 MiB / 647.50 MiB (49.09%) 7.32 MiB/s
355.36 MiB / 647.50 MiB (54.88%) 7.33 MiB/s
390.67 MiB / 647.50 MiB (60.34%) 7.31 MiB/s
426.27 MiB / 647.50 MiB (65.83%) 7.30 MiB/s
464.20 MiB / 647.50 MiB (71.69%) 7.32 MiB/s
499.06 MiB / 647.50 MiB (77.08%) 7.29 MiB/s
533.50 MiB / 647.50 MiB (82.39%) 7.27 MiB/s
570.41 MiB / 647.50 MiB (88.09%) 7.28 MiB/s
605.97 MiB / 647.50 MiB (93.59%) 7.27 MiB/s
643.31 MiB / 647.50 MiB (99.35%) 7.28 MiB/s
647.50 MiB / 647.50 MiB (100.00%) 7.56 MiB/s
Or without redirecting STDOUT:
$ limactl start --silent --tty=false template://docker
647.50 MiB / 647.50 MiB [-----------------------------------] 100.00% 7.16 MiB/s
To run `docker` on the host (assumes docker-cli is installed), run the following commands:
------
docker context create lima-docker --docker "host=unix:///Users/jan/.lima/docker/sock/docker.sock"
docker context use lima-docker
docker run hello-world
------
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.
Now there is only a single (new) option, hopefully it should be less surprising ?
--log-level string Set the logging level [trace, debug, info, warn, error]
Now |
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
I removed the short forms, so now one needs to use the long way of hiding INFO messages:
The old debug flag remains, it could (potentially) do more things than just change log level ?
|
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.
Thanks, LGTM
For a normal run, with downloads already cached, this will only output the message (if any)