Ir al contenido

Prints a timestamped message to the console. Supports glue-style interpolation of variables from the calling environment. Optionally prints and returns a variable value, useful for debugging pipelines.

Uso

log_message(msg, variable = NULL)

log_msg(msg, variable = NULL)

Argumentos

msg

Character. Message to log, supports glue syntax for variable interpolation.

variable

Optional. If provided, appends the value to the message and returns it invisibly.

Valor

Invisibly returns NULL, or the variable if provided.

Ejemplos

# Simple message
log_message("Starting the process...")
#> [2026-04-03 09:15:42] Starting the process...

# With variable interpolation
iso3 <- "KEN"
log_message("Processing {iso3}...")
#> [2026-04-03 09:15:42] Processing KEN...

# With variable return (useful in pipelines)
result <- log_message("Computed value", 42)
#> [2026-04-03 09:15:42] Computed value: 42