daroczig / logger

A lightweight, modern and flexible, log4j and futile.logger inspired logging utility for R
https://daroczig.github.io/logger
Other
290 stars 42 forks source link

New feature request: cli formatter #210

Open pawelru opened 2 months ago

pawelru commented 2 months ago

cli does have a very rich string interpolation mechanism - https://cli.r-lib.org/reference/inline-markup.html What is also nice about it is that it is a zero-dependent package so it does not increase this package a lot.

Currently, using the default glue_formatter I have:

r$> x <- NULL

r$> logger::log_info("x is {x}")
INFO [2024-09-05 11:05:01]

It would be great to have something like this:

r$> cli::cli_inform("{.var x} is {.var {x}}")
`x` is

For NULL value in particular - it is possible to modify glue appender by .null argument but here I do want to make use of other features of cli

daroczig commented 2 months ago

Sounds like a feature request for a new formatter fn, using cli. I am not very familiar with the usage, so would appreciate a PR to make this happen -- otherwise I'll try to pick this up later.