# NOT RUN {
lg <- get_logger("test")
default <- tempfile()
fancy <- tempfile()
json <- tempfile()
lg$add_appender(AppenderFile$new(default), "default")
lg$add_appender(
AppenderFile$new(fancy, layout = LayoutFormat$new("[%t] %c(): %L %m")), "fancy"
)
lg$add_appender(
AppenderFile$new(json, layout = LayoutJson$new()), "json"
)
lg$info("A test message")
readLines(default)
readLines(fancy)
readLines(json)
# cleanup
lg$config(NULL)
unlink(default)
unlink(fancy)
unlink(json)
# }
Run the code above in your browser using DataLab