R/Filter.R
FilterForceLevel.Rd
Overrides the log level of the Appender/Logger that this filter
is attached to to with level
. See also with_log_level()
. It is
recommended to use filters that modify LogEvents only with Loggers, but
they will also work with Appenders.
lgr::EventFilter
-> FilterForceLevel
Inherited methods
new()
Initialize a new FilterForceLevel
FilterForceLevel$new(level)
level
an integer
or character
log level
lg <- get_logger("test")
analyse <- function(){
lg$add_filter(FilterForceLevel$new("info"), "force")
on.exit(lg$remove_filter("force"))
lg$error("an error with forced log level INFO")
}
analyse()
#> INFO [20:04:27.246] an error with forced log level INFO
lg$error("an normal error")
#> ERROR [20:04:27.249] an normal error
lg$config(NULL) # reset config
#> <Logger> [info] test
#>
#> inherited appenders:
#> console: <AppenderConsole> [all] -> console