Skip to content
Back to skills

Futile.Logger

ASecurity

R futile.logger package for log4j-style logging. Use for hierarchical logging with layouts and appenders.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
datadatabaseperformance

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill futile.logger --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Futile.Logger?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Futile.Logger
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-futile-logger/badge)](https://www.skillsdirectory.com/skills/leolin990405-futile-logger)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: futile.logger
description: R futile.logger package for log4j-style logging. Use for hierarchical logging with layouts and appenders.
---

# futile.logger

Log4j-style logging for R.

## Basic Usage

```r
library(futile.logger)

# Log messages
flog.trace("Trace message")
flog.debug("Debug message")
flog.info("Info message")
flog.warn("Warning message")
flog.error("Error message")
flog.fatal("Fatal message")
```

## Formatted Messages

```r
# Printf-style formatting
flog.info("Processing file: %s", filename)
flog.info("Completed %d of %d items", current, total)
flog.info("Value: %.2f", value)

# Multiple arguments
flog.info("User %s performed action %s at %s", user, action, time)
```

## Log Levels

```r
# Set threshold
flog.threshold(INFO)   # Show INFO and above
flog.threshold(DEBUG)  # Show DEBUG and above
flog.threshold(WARN)   # Show WARN and above

# Get current threshold
flog.threshold()

# Log level constants
TRACE, DEBUG, INFO, WARN, ERROR, FATAL
```

## Named Loggers

```r
# Create named logger
flog.threshold(DEBUG, name = "myapp")
flog.info("Message", name = "myapp")

# Hierarchical loggers
flog.threshold(INFO, name = "myapp")
flog.threshold(DEBUG, name = "myapp.database")

# Child inherits from parent unless overridden
flog.info("DB query", name = "myapp.database")
```

## Appenders

```r
# Console (default)
flog.appender(appender.console())

# File
flog.appender(appender.file("app.log"))

# Tee (console and file)
flog.appender(appender.tee("app.log"))

# Multiple appenders
flog.appender(appender.tee("app.log"), name = "myapp")

# Custom appender
my_appender <- function(line) {
  # Custom logic
  cat(line, "\n")
}
flog.appender(my_appender)
```

## Layouts

```r
# Default layout
flog.layout(layout.simple)

# With timestamp
flog.layout(layout.format('[~t] [~l] ~m'))

# Custom format
# ~l = level
# ~t = timestamp
# ~n = namespace
# ~f = calling function
# ~m = message

flog.layout(layout.format('[~t] [~l] [~n] ~m'))

# JSON layout
flog.layout(layout.json)

# Tracing layout (includes function name)
flog.layout(layout.tracing)
```

## Conditional Logging

```r
# Check if level is enabled
if (flog.logger()$threshold <= DEBUG) {
  # Expensive debug computation
  flog.debug("Expensive: %s", expensive_computation())
}
```

## Exception Logging

```r
tryCatch({
  risky_operation()
}, error = function(e) {
  flog.error("Operation failed: %s", e$message)
  flog.debug("Stack trace: %s", paste(sys.calls(), collapse = "\n"))
})
```

## Configuration

```r
# Set up logging at application start
setup_logging <- function() {
  # Set global threshold

  flog.threshold(INFO)

  # Log to file
  flog.appender(appender.tee("logs/app.log"))

  # Custom layout
  flog.layout(layout.format('[~t] [~l] ~m'))

  # Debug logger for development
  flog.threshold(DEBUG, name = "debug")
  flog.appender(appender.file("logs/debug.log"), name = "debug")
}
```

## Capture Output

```r
# Capture function output
flog.capture(my_function(), name = "output")
```

## Performance

```r
# Disable logging in production
flog.threshold(FATAL)  # Only fatal errors

# Or use NULL appender
flog.appender(function(x) invisible(NULL))
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.