Skip to contents

Initializes a logger with a given logfile.

Usage

create_logger(
  my_logfile,
  threshold = c("INFO", "DEBUG", "WARNING", "ERROR", "FATAL"),
  console = FALSE
)

Arguments

my_logfile

path to the log file (character).

threshold

logging levels to write to the logger (see loglevel documentation in log4r). Defalts to INFO.

console

Write log messages to console?

Value

Returns a logger and creates a logfile at the given path. If the path given does not exist, also creates this path.

Examples

logger <- create_logger(tempfile())
#> Create logger /tmp/Rtmp3MYUYp/file6d2b2f2bf0df