set_referee: Set a baton's referee

set_refereeR Documentation

Set a baton's referee

Description

set_referee is a helper function to set the 'referee' of the baton; this controls what threshold of content is written to the logbook. The updated metadata will occur both in the source YAML as well as the R object for paired consistency.

Usage

set_referee(
  baton,
  threshold = getOption("relay_referee", default = "TRACE"),
  suppressWarnings = TRUE,
  autoassign = TRUE,
  envir = .GlobalEnv,
  ...
)

Arguments

baton

R object of S3 class, created by create_baton.

threshold

character value for the minimum threshold for logging to occur (e.g. 'TRACE', 'DEBUG', 'MESSAGE', 'WARNING', 'ERROR').

suppressWarnings

boolean value to determine if warning messages upon YAML write are ignored.

autoassign

boolean value to determine if the passed baton is also refreshed automatically. Recommended as TRUE to avoid having to do manual assignment to provided baton.

envir

Environment where baton exists, default set to .GlobalEnv, only needed when autoassign is TRUE. If deploying on RStudio Connect, may require using knitr::knit_global().

...

Additional parameters passed to assign

Details

The default threshold is set to 'TRACE' and can be overriden directly or by setting the global options via options(relay_referee = 'TRACE').

Value

S3 class object.

Examples

## Not run: 
my_baton <- create_baton()
set_referee(my_baton, 'MESSAGE')
write_logbook(my_baton, 'A super important message')
set_referee(my_baton, 'ERROR')
write_logbook(my_baton, 'This message ignored b/c the referee cares not')
read_logbook(my_baton)

## End(Not run)

al-obrien/relay documentation built on May 6, 2023, 10:19 p.m.