Integrate the message printing function with the cli
package,
and the message
function.
The message could be suppressed by suppressMessages
.
log_message(
...,
verbose = TRUE,
message_type = c("info", "success", "warning", "error"),
cli_model = TRUE
)
log_message("Hello, ", "world!")
#> ℹ Hello, world!
log_message("Hello, ", "world!", message_type = "success")
#> ✔ Hello, world!
log_message("Hello, world!", message_type = "warning")
#> ! Hello, world!
suppressMessages(log_message("Hello, ", "world!"))
log_message("Hello, world!", verbose = FALSE)