Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bru_log

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

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()

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

Author(s)

Fabian E. Bachl bachlfab@gmail.com and Finn Lindgren finn.lindgren@gmail.com

Examples

## Not run: 
if (interactive()) {
  # EXAMPLE1
}

## End(Not run)
## Not run: 
if (interactive()) {
  # EXAMPLE1
}

## End(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()

inlabru

Bayesian Latent Gaussian Modelling using INLA and Extensions

v2.3.1
GPL (>= 2)
Authors
Finn Lindgren [aut, cre, cph] (<https://orcid.org/0000-0002-5833-2011>, Finn Lindgren continued development of the main code), Fabian E. Bachl [aut, cph] (Fabian Bachl wrote the main code), David L. Borchers [ctb, dtc, cph] (David Borchers wrote code for Gorilla data import and sampling, multiplot tool), Daniel Simpson [ctb, cph] (Daniel Simpson wrote the basic LGCP sampling method), Lindesay Scott-Howard [ctb, dtc, cph] (Lindesay Scott-Howard provided MRSea data import code), Seaton Andy [ctb] (Andy Seaton provided testing and bugfixes)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.