with_loggit | R Documentation |
Log code without having to explicitly use the loggit2
handlers.
This is particularly useful for code that cannot be customized, e.g. from third-party packages.
with_loggit(
exp,
logfile = get_logfile(),
echo = get_echo(),
log_level = get_log_level()
)
exp |
An |
logfile |
Path of log file to write to. |
echo |
Should the log entry (json) be echoed to |
log_level |
The log level to use. |
If loggit2
handlers are already used in the expression, this can lead to conditions being logged
twice (in the same or different files).
The result of the expression.
## Not run:
x <- with_loggit(5L + 5L)
with_loggit(base::message("Test log message"))
with_loggit(base::warning("Test log message"), echo = FALSE, logfile = "my_log.log")
x <- with_loggit({
y <- 5L
base::message("Test log message")
base::warning("Test log message")
1L + y
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.