The still-very-new logging package tl was just updated for
the first time at CRAN. The tl package wraps the (also
very new) rspdlite package to
offer a lightweight and consistent logging interface from both R and C++
that enjoys being ‘tiny, fast, capable’ thanks to spdlite. With tl we follow the same idea
that our spdl package
introduced: a simple consistent interface via just the tl::
prefix and the appropropriate logging level. In other words
tl::debug("Alert: foo now '{}'", foo) will work from both R
and C++ (given a variable foo, and, in the case of C++, an
extra semicolon) and log if the current level is ‘debug’ or higher, and
skip logging if not.
This release adds a fallback when compilation does not use the (required) C++20 standard, expands the README and adds a initialization helper function reflecting a preferred default logging level from either an environment variable or a global option. We are also working on adding tl to an example package as a simple illustration, more on that hopefully soon.
The NEWS entry for this release follows.
Changes in version 0.0.2 (2025-06-30)
Added badges to README now that package is on CRAN, add NEWS file
Condition the provided header on C++20 use, offer fallback
Add an exported initialization function picking up a logging level from either an environment variable or a global option, see '?init'
Courtesy of my CRANberries, there is also a diffstat report for the this release.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. If you like this or other open-source work I do, you can sponsor me at GitHub.