nushell: duplicate log level between main binary and the standard library
Related problem
the original discussion appeared in https://github.com/nushell/nushell/issues/8823#issuecomment-1501032490.
Describe the solution you’d like
we had a few ideas
- remove
NU_LOG_LEVELfromstd - deprecate
--log-levelfrom thenubinary - leave both but have
--log-levelset the default value of `NU_LOG_LEVEL
i’d vote for the third right now 😋
Describe alternatives you’ve considered
No response
Additional context and details
No response
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 22 (16 by maintainers)
@fdncred @rgwood 😱 😆
i think i share how @rgwood feels about that 🤔
i do not see
stdbeing that much separate from the “core”nushell=> more an implementation detail as @rgwood said iirc, especially if we’re mainly moving commands fromrusttonushell!and as is say it, i think more and more that we should only have
--log-levelon thenubinary and haveNU_LOG_LEVELalign on the value given when starting the shellwhat follows is that the log format inside
std logshould align with the current one from therustimplementation 🤔💡 that can always be changed quite easily as these are only changes from the library and not from core 😉
TL;DR: i would vote for removing the
NU_LOG_LEVELand use the value given by--log-level😋Good luck. Pro tip: Don’t put ‘trace’ level entries in your scripts because you’ll never find them with
nu --log-level trace.--log-levelis currently used for any Rust logging that uses thelogcrate. I would not say it’s just for the interpreter.Yes:
https://github.com/nushell/nushell/blob/d0a83fec693e50fbe38780aaec932f6b8cc8ed0a/crates/nu-system/src/linux.rs#L98-L99
I think we’re going back and forth here because we actually have 2 separate logging functions, controlled by different flags, which log different kinds of operation:
std logfor logging the operation of custom commands (eventually it will be in widespread use, not now, though). We don’t have to conflate them! And considering the different operations they affect, maybe we shouldn’t try?For me, the only wrinkle is I do not know whether there’s any logging from built in commands. Can anybody say? I would like to be able to say there is just one switch that controls logging for all commands, both custom and built-in, that seems like a clean division of labor.
My use case for the current
NU_LOG_LEVELandstd logis this: I want the convention to be thatstd log infois for verbose progress messages from commands. These are suppressed by default, but can be enabled for a specific invocation. The environment setting prefix is just the ticket for this:this is what i had in mind in the first place i think 👌