
Evaluate R expression with a temporarily updated log level threshold
Source:R/logger.R
with_log_threshold.Rd
Evaluate R expression with a temporarily updated log level threshold
Arguments
Examples
log_threshold(TRACE)
log_trace("Logging everything!")
#> TRACE [2025-01-28 13:49:36] Logging everything!
x <- with_log_threshold(
{
log_info("Now we are temporarily suppressing eg INFO messages")
log_warn("WARN")
log_debug("Debug messages are suppressed as well")
log_error("ERROR")
invisible(42)
},
threshold = WARN
)
#> WARN [2025-01-28 13:49:36] WARN
#> ERROR [2025-01-28 13:49:36] ERROR
x
#> [1] 42
log_trace("DONE")
#> TRACE [2025-01-28 13:49:36] DONE