lg <- get_logger("test")$
set_appenders(AppenderConsole$new())$
set_propagate(FALSE)
lg$appenders[[1]]$set_layout(LayoutGlue$new())
lg$fatal("test")
# All fields of the LogEvent are available, even custom ones
lg$appenders[[1]]$layout$set_fmt(
"{logger} {level_name}({level}) {caller}: {toupper(msg)} {{custom: {custom}}}"
)
lg$fatal("test", custom = "foobar")
lg$config(NULL) # reset logger config
Run the code above in your browser using DataLab