Switch verbosity macros to use group argument #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in this comment, there's currently a semantic error with the verbosity macros where even if my verbosity is explicitly set to 0 or 1, but my log level is
Info
, then a message like:will still be logged, since the current logic just does
Error - 2
.With the change proposed in this PR, we get the following change in behavior:
LoggingExtras.withlevel
or an alternative filter doesn't inspect the group.verbosity argument, then the verbose macros act just like the normal logging macroswithlevel
is used, then the above case acts as expected; i.e. the@errorv 2 msg
case only logs ifwithlevel(Info; verbosity=2)
is set.I opted to wrap the verbosity level in a new
LoggingExtras.Verbosity
struct so that if thegroup
argument is ever used for something else as anInt
, it won't accidentally conflict with the verbosity filtering. We'll still clobber that argument if anyone else tries to use it, but it shouldn't affect cases where people aren't using the verbosity macros.Fixes JuliaWeb/HTTP.jl#938.