gitmyhub

logger

R ★ 1 updated 1y ago ⑂ fork

A lightweight, modern and flexible, log4j and futile.logger inspired logging utility for R

A logging tool for R that helps you track what your scripts are doing by tagging messages by importance, adding timestamps, and routing them to different destinations like files or services.

Rsetup: easycomplexity 2/5

The logger project is a tool for R users who want to add structured, readable logs to their code. Think of it as a smart diary for your scripts — instead of just using print statements, it lets you tag messages by importance (like "info," "warning," or "error"), add timestamps, color-code output, and route different kinds of messages to different destinations. It's designed to be lightweight and flexible, inspired by logging tools from other languages but built to feel natural in R.

At its core, you call functions like log_info() or log_warn() with a message, and it formats and prints them automatically. You can set a threshold so only messages above a certain importance level get shown — handy for keeping things quiet in production but verbose while debugging. What makes it stand out is how customizable it is: you can change the layout, colors, and message formatting, and even stack loggers so that, say, trace-level messages go to the console while only errors get pushed to a service like DataDog or CloudWatch. It also supports namespaces, meaning different R packages loaded in the same session can each have their own logging configuration.

This is useful for data scientists, analysts, and R package developers who run long or complex scripts and need to track what happened, when, and where things went wrong. For example, if you have a pipeline that pulls data from an API, transforms it, and writes it to a database, logging lets you record each step so you can diagnose failures later. It's especially valuable for package authors who want to give users visibility into what the package is doing without cluttering output.

The project exists because the author found existing R logging packages either unmaintained, awkward to extend, or unidiomatic for modern R. The focus is on modularity, familiar naming conventions, and making it easy to plug in custom destinations or formats — all while keeping the default experience simple enough that you can be up and running with a couple of lines.

Where it fits