This function is similar to message()
, and the difference is
that msg_cat()
uses cat()
to write out the message,
which is sent to stdout()
instead of stderr()
. The
message can be suppressed by suppressMessages()
.
msg_cat(...)
Invisible NULL
, with the side-effect of printing the message.
By default, a newline will not be appended to the message. If you need a newline, you have to explicitly add it to the message (see ‘Examples’).
This function was inspired by rlang::inform()
.
{
# a message without a newline at the end
xfun::msg_cat("Hello world!")
# add a newline at the end
xfun::msg_cat(" This message appears right after the previous one.\n")
}
#> Hello world!
#> This message appears right after the previous one.
suppressMessages(xfun::msg_cat("Hello world!"))