Skip to contents

format is passed to glue::glue() with access to the below variables:

Usage

layout_glue_generator(
  format = "{level} [{format(time, \"%Y-%m-%d %H:%M:%S\")}] {msg}"
)

Arguments

format

glue::glue()-flavored layout of the message using the above variables

Value

function taking level and msg arguments - keeping the original call creating the generator in the generator attribute that is returned when calling log_layout() for the currently used layout

Examples

example_layout <- layout_glue_generator(
  format = "{node}/{pid}/{ns}/{ans}/{topenv}/{fn} {time} {level}: {msg}"
)
example_layout(INFO, "try {runif(1)}")
#> runnervmf4ws1/9217/NA/global/R_GlobalEnv/eval 2025-09-10 21:15:25.753036 INFO: try {runif(1)}

log_layout(example_layout)
log_info("try {runif(1)}")
#> runnervmf4ws1/9217/global/global/R_GlobalEnv/eval 2025-09-10 21:15:25.755531 INFO: try 0.695823878981173