You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion/Maintenance: change debug logging from level to an enum #4818
Since diving deeper into fish's internals, I've found it almost impossible to trace what's going on at a given moment without adding debug(0, L".....") to the code in question and then running with debug logging off. The problem is that there's no real means of determining what log level something should be. If it's what you're working on, it's the most important thing. If it's not, you don't care about it.
This proposal is to switch from numbers to an enum, which can be activated by passing in a bitmask as the parameter to -d instead of a number. This bitmask would specify the component instead of the level, and can even be backwards-compatible with what we have in place by reserving values 0-9:
Then you can "opt in" to the log messages you want to receive by specifying -d192' to opt into messages from the tokenizer and parser. Or even fish -d128 -d64to opt in to messages from both these components. Any-d[0-9]` would be interpreted as "this number or lower", while anything 10 or above (well, 16, really) would be interpreted as a bitmask instead.
Having had to calculate the bitmask by hand for various tools (OpenLDAP springs to mind), I am aggressively anti-bitmasks, but as long as you can specify the -d flag more than once it might be reasonable. Having text aliases for them would be a lot more helpful.
Ideally, this would work based on "subsystem", of which the filename is an alright approximation, which would make it automatic - no need to add something to the "debug" call to make it go through that system.
Activity
zanchey commentedon Mar 15, 2018
Having had to calculate the bitmask by hand for various tools (OpenLDAP springs to mind), I am aggressively anti-bitmasks, but as long as you can specify the
-dflag more than once it might be reasonable. Having text aliases for them would be a lot more helpful.faho commentedon Mar 15, 2018
A better division would certainly be appreciated.
Like @zanchey, I'm also not sold on bitmasks.
Ideally, this would work based on "subsystem", of which the filename is an alright approximation, which would make it automatic - no need to add something to the "debug" call to make it go through that system.
ridiculousfish commentedon May 28, 2019
This got addressed in b9ef879