formatter_glue fails when no unnamed arguments
- Dominant language
- HTML
- Stars
- 323
- Forks
- 46
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 1
Description
Occasionally I forget (i.e., when interactive) to set `log_formatter(formatter_json)`. When this happens, any log messages that use named arguments will be blank. For instance,
```r
log_info(quux="foo", a=pi)
# INFO [2023-11-18 19:50:26]
```
where the initial intent was to have this:
```r
log_formatter(formatter_json)
log_info(quux="foo", a=pi)
# INFO [2023-11-18 19:50:54] {"quux":"foo","a":3.1416}
```
I'm fine with the fact that part of the reason is that I forgot the formatter, but it would be nice if `formatter_glue` did not drop named arguments. I suggest the names can be dropped, and pasted together (with a space). Something like:
```r
log_formatter(formatter_glue)
log_info(quux="foo", a=pi)
# INFO [2023-11-18 19:52:12] foo 3.14159265358979
```
---
_Edit_ ... as I'm thinking about this, the purpose and layout of `glue` is rather simple, where unnamed objects are strings to format, and named objects are variables to use for substitution ... so I think the `paste`-ing above should only be done when none of `...` are unnamed ... or perhaps just assume the first or first character or similar.
Bottom line, having it completely drop the message is perhaps not good. Thoughts?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.