diff --git a/R/formatters.R b/R/formatters.R index 92f7ff6..94b64cf 100644 --- a/R/formatters.R +++ b/R/formatters.R @@ -29,6 +29,10 @@ formatter_sprintf <- function(fmt, attr(formatter_sprintf, "generator") <- quote(formatter_sprintf()) #' Apply `glue` to convert R objects into a character vector +#' +#' `formatter_glue()` uses [glue::glue()]; `formatter_glue_safe()` uses +#' [glue::glue_safe()]. +#' #' @param ... passed to `glue` for the text interpolation #' @inheritParams log_level #' @return character vector @@ -63,13 +67,8 @@ formatter_glue <- function(..., attr(formatter_glue, "generator") <- quote(formatter_glue()) -#' Apply `glue_safe` to convert R objects into a character vector -#' @param ... passed to `glue_safe` for the text interpolation -#' @inheritParams log_level -#' @return character vector +#' @rdname formatter_glue #' @export -#' @family `log_formatters` -#' @importFrom utils str formatter_glue_safe <- function(..., .logcall = sys.call(), .topcall = sys.call(-1), diff --git a/man/formatter_glue.Rd b/man/formatter_glue.Rd index 577e660..a44c67e 100644 --- a/man/formatter_glue.Rd +++ b/man/formatter_glue.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/formatters.R \name{formatter_glue} \alias{formatter_glue} +\alias{formatter_glue_safe} \title{Apply \code{glue} to convert R objects into a character vector} \usage{ formatter_glue( @@ -10,6 +11,13 @@ formatter_glue( .topcall = sys.call(-1), .topenv = parent.frame() ) + +formatter_glue_safe( + ..., + .logcall = sys.call(), + .topcall = sys.call(-1), + .topenv = parent.frame() +) } \arguments{ \item{...}{passed to \code{glue} for the text interpolation} @@ -30,7 +38,8 @@ to look up the \code{namespace} as well via \code{logger:::top_env_name}} character vector } \description{ -Apply \code{glue} to convert R objects into a character vector +\code{formatter_glue()} uses \code{\link[glue:glue]{glue::glue()}}; \code{formatter_glue_safe()} uses +\code{\link[glue:glue_safe]{glue::glue_safe()}}. } \note{ Although this is the default log message formatter function, @@ -40,7 +49,6 @@ will be used as a fallback. \seealso{ Other \code{log_formatters}: \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_pander}()}, diff --git a/man/formatter_glue_or_sprintf.Rd b/man/formatter_glue_or_sprintf.Rd index 1d6d1ac..32fbf92 100644 --- a/man/formatter_glue_or_sprintf.Rd +++ b/man/formatter_glue_or_sprintf.Rd @@ -59,7 +59,6 @@ formatter_glue_or_sprintf("Hi \%s, did you know that 2*4=\%s", c("foo", "bar"), \seealso{ Other \code{log_formatters}: \code{\link{formatter_glue}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_pander}()}, diff --git a/man/formatter_glue_safe.Rd b/man/formatter_glue_safe.Rd deleted file mode 100644 index 2b80f8b..0000000 --- a/man/formatter_glue_safe.Rd +++ /dev/null @@ -1,45 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/formatters.R -\name{formatter_glue_safe} -\alias{formatter_glue_safe} -\title{Apply \code{glue_safe} to convert R objects into a character vector} -\usage{ -formatter_glue_safe( - ..., - .logcall = sys.call(), - .topcall = sys.call(-1), - .topenv = parent.frame() -) -} -\arguments{ -\item{...}{passed to \code{glue_safe} for the text interpolation} - -\item{.logcall}{the logging call being evaluated (useful in -formatters and layouts when you want to have access to the raw, -unevaluated R expression)} - -\item{.topcall}{R expression from which the logging function was -called (useful in formatters and layouts to extract the calling -function's name or arguments)} - -\item{.topenv}{original frame of the \code{.topcall} calling function -where the formatter function will be evaluated and that is used -to look up the \code{namespace} as well via \code{logger:::top_env_name}} -} -\value{ -character vector -} -\description{ -Apply \code{glue_safe} to convert R objects into a character vector -} -\seealso{ -Other \code{log_formatters}: -\code{\link{formatter_glue}()}, -\code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_json}()}, -\code{\link{formatter_logging}()}, -\code{\link{formatter_pander}()}, -\code{\link{formatter_paste}()}, -\code{\link{formatter_sprintf}()} -} -\concept{\code{log_formatters}} diff --git a/man/formatter_json.Rd b/man/formatter_json.Rd index 11e513a..2e076a9 100644 --- a/man/formatter_json.Rd +++ b/man/formatter_json.Rd @@ -47,7 +47,6 @@ log_info(mtcars = mtcars, species = iris$Species) Other \code{log_formatters}: \code{\link{formatter_glue}()}, \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_pander}()}, \code{\link{formatter_paste}()}, diff --git a/man/formatter_logging.Rd b/man/formatter_logging.Rd index 52a824a..40825f6 100644 --- a/man/formatter_logging.Rd +++ b/man/formatter_logging.Rd @@ -52,7 +52,6 @@ log_info(12, 1 + 1, 2 * 2) Other \code{log_formatters}: \code{\link{formatter_glue}()}, \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_pander}()}, \code{\link{formatter_paste}()}, diff --git a/man/formatter_pander.Rd b/man/formatter_pander.Rd index ce9571d..c6331fb 100644 --- a/man/formatter_pander.Rd +++ b/man/formatter_pander.Rd @@ -53,7 +53,6 @@ log_info(lm(hp ~ wt, mtcars)) Other \code{log_formatters}: \code{\link{formatter_glue}()}, \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_paste}()}, diff --git a/man/formatter_paste.Rd b/man/formatter_paste.Rd index 1f70352..326038b 100644 --- a/man/formatter_paste.Rd +++ b/man/formatter_paste.Rd @@ -36,7 +36,6 @@ Concatenate R objects into a character vector via \code{paste} Other \code{log_formatters}: \code{\link{formatter_glue}()}, \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_pander}()}, diff --git a/man/formatter_sprintf.Rd b/man/formatter_sprintf.Rd index b74ef40..c52b13d 100644 --- a/man/formatter_sprintf.Rd +++ b/man/formatter_sprintf.Rd @@ -39,7 +39,6 @@ Apply \code{sprintf} to convert R objects into a character vector Other \code{log_formatters}: \code{\link{formatter_glue}()}, \code{\link{formatter_glue_or_sprintf}()}, -\code{\link{formatter_glue_safe}()}, \code{\link{formatter_json}()}, \code{\link{formatter_logging}()}, \code{\link{formatter_pander}()},