Learn R Programming

log4r (version 0.5.0)

level: Set the logging threshold level for a logger dynamically

Description

It can sometimes be useful to change the logging threshold level at runtime. The level() accessor allows doing so.

Usage

level(x)

level(x) <- value

# S3 method for logger level(x)

# S3 method for logger level(x) <- value

available.loglevels()

Value

level() returns the logger's threshold and level<-() returns the modified logger. available.loglevels() returns a named list of all thresholds.

Arguments

x

An object of class "logger".

value

One of "DEBUG", "INFO", "WARN", "ERROR", or "FATAL".

Examples

Run this code
lgr <- logger()
level(lgr) # Prints "INFO".
info(lgr, "This message is shown.")
level(lgr) <- "FATAL"
info(lgr, "This message is now suppressed.")

Run the code above in your browser using DataLab