Skip to content

Conversation

@bburns632
Copy link
Collaborator

This replaces the futile.logger dependency with a custom base R logging class (resolves #336). This is necessary to maintain Pkgnet on CRAN. Thank you past contributors for making this one straightforward via the wrapper on the logger (blame view shows @jameslamb )!

In the process, I also configured this project to be able to leverage Claude Code for quick assistance.

Changes Made

0: Configure Repo for Claude Code

  • Added CLAUDE.md at root
  • Update .Rbuildignore to ignore this file

1. Created Custom Logger Class

File: R/logging.R

  • Implemented SimpleLogger R6 class using only base R functions (message(), warning(), stop())
  • Supports three log levels: INFO (4), WARN (5), and FATAL (6)
  • Includes threshold-based filtering
  • Package-level singleton instance via .get_logger()

2. Maintained Wrapper Functions

File: R/logging.R

  • log_info() - logs informational messages
  • log_warn() - logs warnings and triggers R warning()
  • log_fatal() - logs fatal errors and triggers R stop()
  • silence_logger() - sets threshold to 0 (silent)
  • unsilence_logger() - sets threshold to 4 (INFO level)

3. Created Comprehensive Unit Tests

File: tests/testthat/test-logging.R

  • Tests for SimpleLogger class functionality
  • Tests for threshold management
  • Tests for wrapper functions
  • Tests for silence/unsilence behavior

4. Updated Test Setup/Teardown

  • Modified tests/testthat/setup-logger.R to use new logger
  • Modified tests/testthat/teardown-logger.R to use new logger

5. Removed futile.logger Dependency

  • Removed from DESCRIPTION Imports section
  • Removed from .github/workflows/smoke-tests.yaml workflow
  • All source code references replaced

What Was NOT Changed

  • All existing log_info/log_warn/log_fatal calls throughout the codebase remain unchanged (though they now use the new logger). Thanks contributors for foresight on this one!

Outcome

The implementation maintains backward compatibility with all existing logging calls while removing the external dependency. All tests pass.

@bburns632 bburns632 linked an issue Jan 25, 2026 that may be closed by this pull request
@bburns632 bburns632 force-pushed the 336-cran-warning-futilelogger-set-to-be-archived branch from ef76638 to fc72b4f Compare January 25, 2026 22:50
@bburns632 bburns632 force-pushed the 336-cran-warning-futilelogger-set-to-be-archived branch from 289c084 to ad24829 Compare January 26, 2026 16:14
@bburns632 bburns632 mentioned this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRAN warning: {futile.logger} set to be archived

3 participants