loggit {loggit2}R Documentation

Log entries to file

Description

Log entries to a ndjson log file, defined by set_logfile().

Usage

loggit(
  log_lvl,
  log_msg,
  ...,
  echo = TRUE,
  custom_log_lvl = FALSE,
  sanitizer = default_ndjson_sanitizer
)

Arguments

log_lvl

Log level coerceable to character. For details see parameter custom_log_lvl.

log_msg

Main log message. Will be coerced to class character.

...

Named arguments, each a atomic vector of length one, you wish to log. The names of the arguments are treated as column names in the log.

echo

Should the log file entry be printed to the console as well? Defaults to TRUE.

custom_log_lvl

Allow log levels other than "DEBUG", "INFO", "WARN", and "ERROR"? Defaults to FALSE.

sanitizer

Sanitizer function to run over elements in log data. Defaults to default_ndjson_sanitizer().

Value

Invisible NULL.

Examples

  loggit("INFO", "This is a message", but_maybe = "you want more fields?",
  sure = "why not?", like = 2, or = 10, what = "ever")


[Package loggit2 version 2.2.2 Index]