Learn R Programming

inlabru (version 2.3.1)

bru_log_reset: inlabru log message methods

Description

Resets the inlabru log object

Retrieve, add, and/or print log messages

Usage

bru_log_reset()

bru_log_get(pretty = FALSE)

bru_log_message( ..., domain = NULL, appendLF = TRUE, verbosity = 1, allow_verbose = TRUE, verbose = NULL, verbose_store = NULL )

bru_log(txt, verbose = NULL)

bru_log_active(activation = NULL)

Arguments

pretty

logical; If TRUE, return a single string with the log messages separated and terminated by line feeds, suitable for cat(...). If FALSE, return the raw log as a vector of strings, suitable for cat(..., sep = "\n"). Default: FALSE

...

Zero or more objects passed on to base::.makeMessage()

domain

Domain for translations, passed on to base::.makeMessage()

appendLF

logical; whether to add a newline to the message. Only used for verbose output.

verbosity

numeric value describing the verbosity level of the message

allow_verbose

Whether to allow verbose output. Must be set to FALSE until the options object has been initialised.

verbose

logical; if TRUE, print the log message on screen with message(txt). Default: bru_options_get("bru_verbose")

verbose_store

Same as verbose, but controlling what messages are stored in the global log object. Can be controlled via the bru_verbose_store with bru_options_set().

txt

character; log message.

activation

logical; whether to activate (TRUE) or deactivate (FALSE) the inlabru logging system. Default: NULL, to keep the current activation state

Value

bru_log_get RETURN_VALUE

  • bru_log_message OUTPUT_DESCRIPTION

bru_log invisibly returns the added log message.

bru_log_active returns the previous activation state

Details

bru_log_reset() clears the log contents.

  • bru_log_message DETAILS

The log message is stored if the log is active, see bru_log_active()

Examples

Run this code
# NOT RUN {
if (interactive()) {
  # EXAMPLE1
}
# }
# NOT RUN {
if (interactive()) {
  # EXAMPLE1
}
# }
# NOT RUN {
code_runner <- function() {
  oa <- bru_log_active(TRUE)
  on.exit(bru_log_active(oa))
  bru_log("Test message")
}
bru_log_active()
code_runner()
cat(bru_log_get())
bru_log_active()
# }

Run the code above in your browser using DataLab