1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_glue_generator}
\alias{layout_glue_generator}
\title{Generate log layout function using common variables available via glue syntax}
\usage{
layout_glue_generator(
format = "{level} [{format(time, \\"\%Y-\%m-\%d \%H:\%M:\%S\\")}] {msg}"
)
}
\arguments{
\item{format}{\code{glue}-flavored layout of the message using the above
variables}
}
\value{
function taking \code{level} and \code{msg} arguments - keeping the
original call creating the generator in the \code{generator} attribute
that is returned when calling \code{\link[=log_layout]{log_layout()}} for the currently
used layout
}
\description{
\code{format} is passed to \code{glue} with access to the below variables:
\itemize{ \item msg: the actual log message \item further variables
set by \code{\link[=get_logger_meta_variables]{get_logger_meta_variables()}} }
}
\examples{
\dontshow{old <- logger:::namespaces_set()}
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)}")
\dontshow{logger:::namespaces_set(old)}
}
\seealso{
See example calls from \code{\link[=layout_glue]{layout_glue()}} and \code{\link[=layout_glue_colors]{layout_glue_colors()}}.
Other log_layouts:
\code{\link{get_logger_meta_variables}()},
\code{\link{layout_blank}()},
\code{\link{layout_glue}()},
\code{\link{layout_glue_colors}()},
\code{\link{layout_json}()},
\code{\link{layout_json_parser}()},
\code{\link{layout_logging}()},
\code{\link{layout_simple}()}
}
\concept{log_layouts}
|