Learn R Programming

lgr (version 0.4.4)

FilterForceLevel: Override the log level of all events processed by a Logger/Appender

Description

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.

Arguments

Super class

lgr::EventFilter -> FilterForceLevel

Public fields

level

an integer log level used to override the log levels of each LogEvent processed by this filter.

Methods


Method new()

Initialize a new FilterForceLevel

Usage

FilterForceLevel$new(level)

Arguments

level

an integer or character log level


Method clone()

The objects of this class are cloneable with this method.

Usage

FilterForceLevel$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
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()
lg$error("an normal error")
lg$config(NULL)  # reset config

Run the code above in your browser using DataLab