Verbosity flags in R code #325
Labels
best-practice
Towards best practices
r-package
Anything r-package
r-stats
Anything r
ropensci
Anything rOpenSci
https://ropensci.org/blog/2024/02/06/verbosity-control-packages/
I like the spirit of this, but disagree with the approach.
Namely, I like the
logger
approach for package developers (https://daroczig.github.io/logger/articles/r_packages.html), since that gives a very practical way to set different logging levels for different namespaces (packages).For example, to only enable detailed logging from the
workflow.factset
package, with the rest of your environment at a higher level, you could haveThis could be easily extended and built into a package infrastructure with something along the lines of
Which would look through a series of options ancd envvars (growing more generic as it looks) until it finds a valid logging level.
About the only thing that I'm not a fan of with
logger
is that it "doubles up" on the normal R output tostdout
if you want ot retain use of the normalwarnings
andstop
functions (for controlling execution), but it does allow for very informative messages (due to usingglue
by default), and can be combined with thebase::warning()
/base::stop()
if you want:The text was updated successfully, but these errors were encountered: