# NOT RUN {
# create a new logger with propagate = FALSE to prevent routing to the root
# logger. Please look at the section "Logger Hirarchies" in the package
# vignette for more info.
lg <- get_logger("test")$set_propagate(FALSE)
lg$add_appender(AppenderConsole$new())
lg$add_appender(AppenderConsole$new(
layout = LayoutFormat$new("[%t] %c(): [%n] %m", colors = getOption("lgr.colors"))))
# Will output the message twice because we attached two console appenders
lg$warn("A test message")
lg$config(NULL) # reset config
# }
Run the code above in your browser using DataLab