How logger works: Core concepts
mainlogger is a lightweight, extensible logging utility for R designed to be flexible and modern.
Key architectural concepts include:
- Glue-based formatting: By default, it uses
glue()for rendering log messages, allowing for easy string interpolation. - Vectorization support: It supports passing vectors to be logged on multiple lines.
- Extensibility: Users can create custom layouts (how a log looks), message formats, and destinations (where logs go).
- Namespace support: It can automatically find and create custom namespaces for R packages, allowing per-package log level thresholds and formats.
- Logger Hierarchy: It supports stacking loggers, allowing a single
logcall to route different levels to different destinations (e.g.,TRACEto console,ERRORto DataDog).