R/layouts.R
layout_glue_generator.Rdformat is passed to glue::glue() with access to the below variables:
msg: the actual log message
further variables
set by get_logger_meta_variables()
layout_glue_generator(
format = "{level} [{format(time, \"%Y-%m-%d %H:%M:%S\")}] {msg}"
)glue::glue()-flavored layout of the message using the above
variables
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
See example calls from layout_glue() and layout_glue_colors().
Other log_layouts:
get_logger_meta_variables(),
layout_blank(),
layout_gha(),
layout_glue(),
layout_glue_colors(),
layout_json(),
layout_json_parser(),
layout_logging(),
layout_simple()
example_layout <- layout_glue_generator(
format = "{node}/{pid}/{ns}/{ans}/{topenv}/{fn} {time} {level}: {msg}"
)
example_layout(INFO, "try {runif(1)}")
#> ip-10-2-72-104/3959154/NA/global/R_GlobalEnv/eval 2025-09-17 13:55:09.535779 INFO: try {runif(1)}
log_layout(example_layout)
log_info("try {runif(1)}")
#> ip-10-2-72-104/3959154/global/global/R_GlobalEnv/eval 2025-09-17 13:55:09.538705 INFO: try 0.695823878981173