The Anatomy of a Log Request

log_info('Hello, {name}') /dev/null logger log_threshold Throws away low level log requests log_formatter Converts the R objects to be logged into a character vector log_layout Render actual log record(s) from the message log_appender Deliver log record to destination message <- "Hello, world!" line <- "INFO [2019-09-19 04:58:13] {message}" cat(line, file = stderr()) get_logger_meta_variables Collect useful information about the environment of the log record request. INFO [2019-09-19 04:58:13] Hello, world! formatter_glue layout_simple appender_console

To make a successful log record, logger requires the below components:

Putting all these together (by explicitly setting the default config in the global namespace):

log_threshold(INFO)
log_formatter(formatter_glue)
log_layout(layout_simple)
log_appender(appender_console)
log_debug('I am a low level log message that will not be printed with a high log level threshold')
log_warn('I am a higher level log message that is very likely to be printed')

Note, that all logger definitions and requests are tied to a logging namespace, and one log request might trigger multiple logger definitions as well (stacking). Find more information on these in the Customizing the format and destination of log records vignette.