The package writes an INFO+ trace to a session temp file (logger appender
index 1) and echoes WARN+ to the console (index 2). Both
logger::log_appender() and logger::log_threshold() default to
index = 1, so the obvious two-line recipe silences the file and
leaves the console untouched, which is the opposite of what anyone wants.
This helper names the right index.
Arguments
- quiet
TRUE(default) silences the console echo;FALSErestores the package default, WARN+. A logger threshold (logger::ERROR, or the value a previous call returned) sets that level instead, which is how to put back exactly what was in force rather than the default:old <- spatialkit_quiet(); spatialkit_quiet(old).
Value
Invisibly, the threshold that was in force before the change, a
logger level that can be passed back as quiet.
Details
These are log records, not R conditions: suppressWarnings()
and tryCatch(warning = ) do not see them. Conditions the package
raises as real R warnings are unaffected by this function.
While a document is being knitted (R Markdown, Quarto, a pkgdown
article) the console echo is also sent as an R message, because
knitr does not capture what is written to the console's error stream
and the cautions would otherwise be missing from the output. They appear
as ## WARN [...] lines, and the chunk option message = FALSE,
like suppressMessages(), keeps them out of the document. A line the
package also raises as an R warning is not repeated, since the document
shows the warning. Outside knitr nothing changes.
See also
Other package options and caches:
clear_fitted_cache(),
clear_grid_cache(),
create_grid_polygons_cached()