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.
A new small package of mine just hit CRAN. The tl package wraps the (also very new) rspdlite package (announced last week) to offer a lightweight and consistent logging interface from both R and C++ that is also ‘tiny, fast, capable’ thanks to rspdlite.
The rspdlite
announcement is a good place to get a first glimpse at that package;
the upstream spdlite
repo has all the details (for the C++ side of things). 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 is at '{}'", foo) will work from
both R and C++ (given a variable foo, and in the case of
C++ an extra semicolon). Just give it a try, and see how it goes. The
package is still young and small.
The NEWS entry for this release is also very simple and just announces that we have a release. More details are in the ChangeLog and the GitHub repo.
Changes in version 0.0.1 (2025-06-17)
- Initial CRAN upload
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.