Adds a log message.
Usage
bru_log_message(
...,
domain = NULL,
appendLF = TRUE,
verbosity = 1L,
allow_verbose = TRUE,
verbose = NULL,
verbose_store = NULL,
x = NULL
)
Arguments
- ...
For
bru_log_message()
, zero or more objects passed on tobase::.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, numeric, or
NULL
; local override for verbose output. IfNULL
, the global optionbru_verbose
or default value is used. IfFALSE
, no messages are printed. IfTRUE
, messages withverbosity
\(\le 1\) are printed. If numeric, messages withverbosity
\(\le\)verbose
are printed.- verbose_store
Same as
verbose
, but controlling what messages are stored in the global log object. Can be controlled via thebru_verbose_store
withbru_options_set()
.- x
A
bru_log
object. IfNULL
, refers to the globalinlabru
log.
See also
Other inlabru log methods:
bru_log()
,
bru_log_bookmark()
,
bru_log_new()
,
bru_log_offset()
,
bru_log_reset()
Examples
if (interactive()) {
code_runner <- function() {
local_bru_options_set(
# Show messages up to and including level 2 (default 0)
bru_verbose = 2,
# Store messages to an including level 3 (default Inf, storing all)
bru_verbose_store = 3
)
bru_log_bookmark("bookmark 1")
bru_log_message("Test message 1", verbosity = 1)
bru_log_message("Test message 2", verbosity = 2)
bru_log_bookmark("bookmark 2")
bru_log_message("Test message 3", verbosity = 3)
bru_log_message("Test message 4", verbosity = 4)
invisible()
}
message("Run code")
code_runner()
message("Check log from bookmark 1")
print(bru_log()["bookmark 1"])
message("Check log from bookmark 2")
print(bru_log()["bookmark 2"])
}