Print a message based on the level of verbosity
print_this_msg(..., msg_type = c("INFO", "DEBUG", "WARNING", "STOP", "ERROR"))The variables that will be pasted in the message.
The type of message, one of "INFO", "DEBUG", "WARNING" or "STOP" (may also accept "ERROR" which is translated as "STOP").
None
opt_warn <- options()$warn
set_verb_level(1)
print_this_msg("Hello world!", msg_type = "INFO")
#> |-- INFO : Hello world!
set_verb_level(3)
print_this_msg("Debugging message", msg_type = "DEBUG")
#> |-- DEBUG : Debugging message
set_verb_level(0)
print_this_msg("Hello world!", msg_type = "INFO")
print_this_msg("Debugging message", msg_type = "DEBUG")
options(warn=-1)
print_this_msg("A warning message not displayed", msg_type = "WARNING")
options(warn=opt_warn)