basic_config {lgr} | R Documentation |
Basic Setup for the Logging System
Description
A quick and easy way to configure the root logger. This is less powerful
then using lgr$config()
or lgr$set_*()
(see Logger), but reduces the
most common configurations to a single line of code.
Usage
basic_config(
file = NULL,
fmt = "%L [%t] %m",
timestamp_fmt = "%Y-%m-%d %H:%M:%OS3",
threshold = "info",
appenders = NULL,
console = if (is.null(appenders)) "all" else FALSE,
console_fmt = "%L [%t] %m %f",
console_timestamp_fmt = "%H:%M:%OS3",
memory = FALSE
)
Arguments
file |
|
fmt |
|
timestamp_fmt |
see |
threshold |
|
appenders |
a single Appender or a list thereof. |
console |
|
console_fmt |
|
console_timestamp_fmt |
|
memory |
|
Value
the root
Logger (lgr)
Examples
# log to a file
basic_config(file = tempfile())
unlink(lgr$appenders$file$file) # cleanup
basic_config(file = tempfile(fileext = "jsonl"))
unlink(lgr$appenders$file$file) # cleanup
# log debug messages to a memory buffer
basic_config(threshold = "all", memory = "all", console = "info")
lgr$info("an info message")
lgr$debug("a hidden message")
show_log()
# reset to default config
basic_config()