Modern Logging for the R Ecosystem

An effortless 'ndjson' (newline-delimited 'JSON') logger, with two primary log-writing interfaces. It provides a set of wrappings for base R's message(), warning(), and stop() functions that maintain identical functionality, but also log the handler message to an 'ndjson' log file. 'loggit' also exports its internal 'loggit()' function for powerful and configurable custom logging. No change in existing code is necessary to use this package, and should only require additions to fully leverage the power of the logging system. 'loggit' also provides a log reader for reading an 'ndjson' log file into a data frame, log rotation, and live echo of the 'ndjson' log messages to terminal 'stdout' for log capture by external systems (like containers). 'loggit' is ideal for Shiny apps, data pipelines, modeling work flows, and more. Please see the vignettes for detailed example use cases.


News

loggit version 1.1.1

  • Automatically coerce any entries for 'log_lvl' and 'log_msg' fields to be character,.

  • (Github-only): loggit() no longer allows for a data frame to be passed as an argument; the underlying code was not writen very well, and I got ahead of myself in throwing it in there. loggit() is, however, still vectorized by nature, so users can still pass vectors to, for example, the log_detail argument, and values will be recycled according to R's usual recycling rules.

loggit version 1.1.0

  • Add get_logs(), which returns a data frame of a provided log file. Returns the current log file by default.

  • (Github-only): loggit() now allows for a data frame to be passed as the sole argument, and have its results be logged. Required column names are the same as the first two arguments to loggit(): "log_lvl" and "log_msg". Any additional number of columns can be supplied.

loggit version 1.0.0

  • This is the first CRAN release of the loggit package. Included features are the masking functions for base R's exception handlers (message, warning, and stop), as well as the loggit() function, which is wrapped in those calls.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("loggit")

2.1.0 by Ryan Price, 5 months ago


https://github.com/ryapric/loggit


Report a bug at https://github.com/ryapric/loggit/issues


Browse source code at https://github.com/cran/loggit


Authors: Ryan Price [cre, aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests knitr, rmarkdown, testthat


See at CRAN