log_error: Logging functions

log_errorR Documentation

Logging functions

Description

log_... functions produce a log entry.

journal_summary prints a quick summary (status counts) based on the journal.

simplify_journal returns a simplified form of the results in the journal.

Usage

log_error(
  text,
  ...,
  output = getOption("check.log.output", "cli"),
  file = getOption("check.log.file", NULL),
  signal = getOption("check.log.conditions", FALSE),
  .envir = parent.frame()
)

log_success(
  text,
  ...,
  output = getOption("check.log.output", "cli"),
  file = getOption("check.log.file", NULL),
  signal = getOption("check.log.conditions", FALSE),
  .envir = parent.frame()
)

log_note(
  text,
  ...,
  output = getOption("check.log.output", "cli"),
  file = getOption("check.log.file", NULL),
  signal = getOption("check.log.conditions", FALSE),
  .envir = parent.frame()
)

log_warning(
  text,
  ...,
  output = getOption("check.log.output", "cli"),
  file = getOption("check.log.file", NULL),
  signal = getOption("check.log.conditions", FALSE),
  .envir = parent.frame()
)

journal_summary(journal = getOption("check.log.journal"), file = stdout())

simplify_journal(journal = getOption("check.log.journal"))

Arguments

text

string, description of the error that occurred, will be passed to glue.

...

additional inputs for text passed to the glue function.

output

type of the output, can either a string ("cli" to use the cli package (default), "R" for standard R facilities or "none" for no output) or a connection. It uses the "check.log.output" option if set.

file

connection to log a copy of the output to or NULL (default) if no additional copy is desired. It uses the "check.log.file" option.

signal

logical, if TRUE then a condition is signalled at the end of the function. All conditions have superclass "RJcheckCondition" and subclass "RJCheck<result>" where <result> is one of SUCCESS, NOTE, WARNING and ERROR. They also have the corresponding standard R condition classes. Uses option "check.log.conditions".

.envir

the environment used to find the text string replacements

journal

environment of the journal

Details

Most arguments are intended to be set with options to allow the use of the checking mechanism both in interactive and automated settings. There are four types of log entries: SUCCESS, NOTE, WARNING and ERROR. If the "check.log.journal" option is set to an environment then the entry is also added to the journal.

Value

log_... string with the result type. The corresponding condition object with a message and call is included in the "info" attribute (even if no condition is signalled).

journal_summary table of the status counts

simplify_journal string matrix with columns "result" (status), "test" (name of the calling function) and "message"


rjtools documentation built on May 29, 2024, 9:57 a.m.