Open gnomeria opened 9 months ago
Similar: #490 🤦 #519
@reitzig this is indeed similar, as you referenced this exact issue identifier.
It looks like to me you referenced the wrong id
Yeah, seems like I couldn't keep even two tabs straight for 30s ... 🙈
Just piling in to say this would be a fantastic addition, as not having a way to specify or change the log level kind of defeats the purpose of using a custom logger in the first place unless you're solely using it for the formatting options. Gum's README.md doesn't make this very clear either, as it points users to the log repo for more info on further usage.
For anyone using fish
shell who want a less than ideal workaround, you could define a globally exported variable in your fish config named something like GUM_LOG_LEVEL
and set it to whatever you'd like the default to be.
From there, you could create a function script in your /fish/functions/
directory named gum.fish
that has --wraps "gum log"
appended to it. Then, you could suppress output in interactive shells depending on what the current GUM_LOG_LEVEL
is. You could also capture and validate whatever's passed to the -l
or --level
parameter and update GUM_LOG_LEVEL
accordingly, giving you an easy method of updating the log level. In theory, the gum log
command should still function identically and provide completions as it normally would.
If you want to take it a step further in the same function script, you could define custom colors for each log level and set GUM_LOG_LEVEL_FOREGROUND
depending on the current value of GUM_LOG_LEVEL
. This essentially allows you to customize the colors used for each log level's label in the terminal. This is another piece of missing functionality from gum log
, but that's probably best left for its own issue.
Still far from an ideal solution, but it achieves the bare minimum functionality.
Is your feature request related to a problem? Please describe. I was trying to use
gum log
as part of my shell script function loggings. But doing so with thegum log --level debug
will always printing it to console. Is it possible to have the minimum log_level to be shown so that even though I calledgum log --level debug "Hello this is a debug command"
it will not be shown?Describe the solution you'd like If for example I set
LOG_LEVEL=info
in the env var, callinggum log --level debug "Hello this is a debug command"
will not show anything to the console?Describe alternatives you've considered Manually checking the
LOG_LEVEL
variable in shell script, but will be a hassle since it needs to be checked each time there's a log commandAdditional context