with_verbosity | R Documentation |
with_verbosity()
and local_verbosity()
are useful for debugging httr2
code buried deep inside another package, because they allow you to change
the verbosity even when you don't have access to the request.
Both functions work by temporarily setting the httr2_verbosity
option. You
can also control verbosity by setting the HTTR2_VERBOSITY
environment
variable. This has lower precedence than the option, but can be more easily
changed outside of R.
with_verbosity(code, verbosity = 1)
local_verbosity(verbosity, env = caller_env())
code |
Code to execture |
verbosity |
How much information to print? This is a wrapper
around
Use |
env |
Environment to use for scoping changes. |
with_verbosity()
returns the result of evaluating code
.
local_verbosity()
is called for its side-effect and invisibly returns
the previous value of the option.
fun <- function() {
request("https://httr2.r-lib.org") |> req_perform()
}
with_verbosity(fun())
fun <- function() {
local_verbosity(2)
# someotherpackage::fun()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.