This package extends the message()
, warning()
and stop()
functions by adding levels
of messages and the option to record them in a log file.
Messages come in three types: "INFO", "WARNING" and "ERROR", as produced by the functions
info()
, warn()
and error()
, which are equivalent to message()
, warning()
and
stop()
. respectively. When executing code the types to display can be specified as an
option. For example, you can ignore "INFO" and only show "WARNING"s and "ERROR"s by setting:
options(msgr.types = c("WARNING", "ERROR"))
Whenever info()
, warn()
or error()
are used a level can be specified, and when
executing the code the levels to display can be specified as an option. The message is
only shown if its level is less than, or equal to, the level option.
options(msgr.level = 1)
warn("This is an important warning!", level = 1)
info("This is useful information, but not important!", level = 3)
Message can also be written to a log file. The log file can be specified each time you use
info()
, warn()
or error()
, or you can specify it as an option.
options(msgr.log_path = "~/msgr.log")
info("This is written to console and log file")
error("This is written to console and an error log", log_path = "~/msgr-errors.log")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.