daroczig / logger

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

Q: How to set log_threshold by string? #108

Closed tentacles-from-outer-space closed 2 years ago

tentacles-from-outer-space commented 2 years ago

How to set logger::log_threshold when level is provided as string or something else (int?)?

Real life case: I want to set threshold level in parameterized Rmarkdowns (as one of parameters). So I was thinking about something like rmarkdown::render("x.Rmd", params = list(my_level="TRACE")) but I don't know what to do with this string. There is no as.loglevel function.

daroczig commented 2 years ago

Hm, I think a getFromNamespace might be enough for the above, but I like the idea of as.loglevel so adding that in a bit.