| pipeflow_lgr | R Documentation |
The logging function that pip_run() uses by default. It writes one line
per message to the console in the form
<level> [<UTC time stamp>]: <msg>, for example
info [2026-01-01 12:34:56.789 UTC]: Step 1/2 load.
pipeflow_lgr(level, msg)
level |
The log level, one of |
msg |
The message, a single string. |
It is exported so that custom loggers can build on it, for example to add a
prefix, or to drop some levels and pass the rest on to the default logger.
A logger is any function with the arguments level and msg.
pip_run() calls it as lgr(level = level, msg = msg).
NULL, invisibly.
pip_run() for how loggers are used and how to switch logging
off with lgr = NULL.
pipeflow_lgr("info", "Hello")
p <- pip_new("demo") |>
pip_add("load", \(n = 3) seq_len(n)) |>
pip_add("double", \(x = ~load) x * 2)
# Add a prefix to every message
prefixed <- function(level, msg) {
pipeflow_lgr(level, paste("[demo]", msg))
}
pip_run(p, lgr = prefixed)
# Drop the "info" messages and pass the rest on
quiet <- function(level, msg) {
if (level != "info") {
pipeflow_lgr(level, msg)
}
}
pip_run(p, lgr = quiet, force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.