handlers: loggit's Exception Handlers

Description Usage Arguments Examples

Description

These exception handlers are identical to base R's message, warning, and stop, but with included logging of the exception messages via loggit().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
message(..., domain = NULL, appendLF = TRUE, .loggit = TRUE, echo = TRUE)

warning(
  ...,
  call. = TRUE,
  immediate. = FALSE,
  noBreaks. = FALSE,
  domain = NULL,
  .loggit = TRUE,
  echo = TRUE
)

stop(..., call. = TRUE, domain = NULL, .loggit = TRUE, echo = TRUE)

Arguments

...

zero or more objects which can be coerced to character (and which are pasted together with no separator) or (for message only) a single condition object.

domain

see gettext. If NA, messages will not be translated, see also the note in stop.

appendLF

logical: should messages given as a character string have a newline appended?

.loggit

Should loggit function execute? Defaults to TRUE.

echo

Should loggit's log entry be echoed to the console, as well? Defaults to TRUE.

call.

logical, indicating if the call should become part of the warning message.

immediate.

logical, indicating if the call should be output immediately, even if getOption("warn") <= 0.

noBreaks.

logical, indicating as far as possible the message should be output as a single line when options(warn = 1).

Examples

1
2
3
4
5
  if (2 < 1) message("Don't say such silly things!")

  if (2 < 1) warning("You may want to review that math, and so this is your warning")

  if (2 < 1) stop("This is a completely false condition, which throws an error")

loggit documentation built on Feb. 28, 2021, 9:06 a.m.