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
Switch verbosity macros to use group argument (#73)
* Switch verbosity macros to use group argument
As noted in [this comment](https://github.com/JuliaLogging/LoggingExtras.jl/pull/64/files#r903295686),
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:
```julia
@errorv 2 "more detailed error message than you normally want to see"
```
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:
* If `LoggingExtras.withlevel` or an alternative filter doesn't inspect
the group.verbosity argument, then the verbose macros act just like
the normal logging macros
* If `withlevel` _is_ used, then the above case acts as expected; i.e.
the `@errorv 2 msg` case only logs if `withlevel(Info; verbosity=2)`
is set.
I opted to wrap the verbosity level in a new `LoggingExtras.Verbosity` struct
so that if the `group` argument is ever used for something else as an `Int`,
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.
FixesJuliaWeb/HTTP.jl#938.
* additional test
* Update src/verbosity.jl
Co-authored-by: Frames Catherine White <[email protected]>
* inject Verbosity into quote expansion
Co-authored-by: Frames Catherine White <[email protected]>
0 commit comments