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"])
}
Run the code above in your browser using DataLab