layout_glue_generator: Generate log layout function using common variables available...

Description Usage Arguments Value See Also Examples

View source: R/layouts.R

Description

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

Usage

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

Arguments

format

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

See Also

See example calls from layout_glue and layout_glue_colors.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
example_layout <- layout_glue_generator(
  format = '{node}/{pid}/{ns}/{ans}/{topenv}/{fn} {time} {level}: {msg}')
example_layout(INFO, 'try {runif(1)}')

log_layout(example_layout)
log_info('try {runif(1)}')

## End(Not run)

logger documentation built on Oct. 19, 2021, 9:07 a.m.