Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f633f9e
stating myself back as maintainer
May 21, 2026
ec45c0e
fixing a moved reference page
May 21, 2026
3619699
issue 29: failure to log dates.
May 21, 2026
52628e9
bumping to 1.0-0, adding github workflows for ci.
May 22, 2026
bd4fa8c
getting github CI workflows to work.
May 22, 2026
f229272
getting github CI workflows to work.
May 22, 2026
ecf15d5
getting github CI workflows to work.
May 22, 2026
812c1b9
getting github CI workflows to work.
May 22, 2026
943053e
getting github CI workflows to work.
May 25, 2026
a20b20b
getting github CI workflows to work.
May 25, 2026
9709d16
added test-coverage workflow
May 25, 2026
280ddfd
getting github CI test-coverage workflow to work.
May 25, 2026
15da277
getting github CI test-coverage workflow to work.
May 25, 2026
b567784
getting github CI test-coverage workflow to work.
May 25, 2026
62796c9
getting github CI test-coverage workflow to work.
May 25, 2026
b794e03
added base path, possibly needed to show source files in coveralls
May 25, 2026
3d3bb07
update NEWS, stating new 1.0-0 version, plus workflows.
May 25, 2026
832d28c
updated installation description, corrected repository link.
May 25, 2026
ee59321
rimossa variabile globale non utilizzata
May 25, 2026
2e7ff74
due file generati, ma utili.
May 25, 2026
fa8b552
aggiunto test con oldrel, rimossi devel da windows e macos.
May 25, 2026
dc96020
rimosso output spurio, migliorato test
May 25, 2026
b876f8b
aggiunti test per output colorato
May 25, 2026
02bdf57
ripuliti i due test sui colori, forzano console colorante.
May 25, 2026
7ac56ce
corretti i badges
May 25, 2026
ff597dc
removed not-completely-correct type description.
May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.

name: R-CMD-check
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
r-version: oldrel
- os: ubuntu-latest
r-version: release
- os: ubuntu-latest
r-version: devel
- os: macos-latest
r-version: release
- os: windows-latest
r-version: release
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
if: runner.os == 'Linux'
run: sudo apt-get install -y libcurl4-openssl-dev
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: pkg
extra-packages: any::rcmdcheck
- uses: r-lib/actions/check-r-package@v2
with:
working-directory: pkg
args: 'c("--as-cran", "--no-manual")'
error-on: '"error"'
52 changes: 52 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: test-coverage
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Install system dependencies
run: sudo apt-get install -y libcurl4-openssl-dev

- uses: r-lib/actions/setup-r@v2
with:
r-version: release

- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: pkg
extra-packages: any::covr, any::xml2
needs: coverage

- name: Generate coverage report (Cobertura)
run: |
cov <- covr::package_coverage(path = "pkg", quiet = FALSE)
print(cov)
covr::to_cobertura(cov, filename = "cobertura.xml")
shell: Rscript {0}

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: cobertura.xml
format: cobertura
base-path: pkg
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find "${{ runner.temp }}/package" -name "testthat.Rout*" -exec cat "{}" \; || true
shell: bash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
pkg.Rcheck
.Rproj.user
report.xml
/logging.Rcheck/
/logging_*.tar.gz
/pkg/tests/testthat/_problems/
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Travis | Total downloads | Downloads | CRAN version |
| :----------------: | :----------------: | :----------------: | :----------------: |
| [![Travis build status](https://travis-ci.com/WLOGSolutions/r-logging.svg?branch=master)](https://travis-ci.com/WLOGSolutions/r-logging) | [![CRAN total downloads](http://cranlogs.r-pkg.org/badges/grand-total/logging)](http://cranlogs.r-pkg.org/badges/grand-total/logging)| [![CRAN downloads](https://cranlogs.r-pkg.org/badges/logging)](https://cranlogs.r-pkg.org/badges/logging)| [![CRAN version](http://www.r-pkg.org/badges/version/logging)](http://www.r-pkg.org/badges/version/logging)|
| R-CMD-check | Total downloads | Downloads | CRAN version | Coverage |
| :----------------: | :----------------: | :----------------: | :----------------: | :------------: |
| [![R-CMD-check](https://github.com/mfrasca/r-logging/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mfrasca/r-logging/actions/workflows/R-CMD-check.yaml) | [![CRAN total downloads](http://cranlogs.r-pkg.org/badges/grand-total/logging)](http://cranlogs.r-pkg.org/badges/grand-total/logging)| [![CRAN downloads](https://cranlogs.r-pkg.org/badges/logging)](https://cranlogs.r-pkg.org/badges/logging)| [![CRAN version](http://www.r-pkg.org/badges/version/logging)](http://www.r-pkg.org/badges/version/logging)|[![Coverage Status](https://coveralls.io/repos/github/mfrasca/r-logging/badge.svg?branch=master)](https://coveralls.io/github/mfrasca/r-logging?branch=master)|

r-logging
=========
Expand Down Expand Up @@ -28,7 +28,20 @@ on [r-forge] (http://r-forge.r-project.org/).

installation
============
Simply call
For the last released package:
```
devtools::install_github("WLOGSolutions/r-logging/pkg")
install.packages("logging")
```

if you want the latest from github, you could do:
```
devtools::install_github("mfrasca/r-logging/pkg")
```

if you have cloned the github repository while your working directory
was `BASE`, you may want to use your local, possibly altered copy:
```
devtools::install_local("BASE/r-logging/pkg")
```


8 changes: 4 additions & 4 deletions pkg/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: logging
Version: 0.10-108
Version: 1.0-0
Title: R Logging Package
Authors@R: c(
person("Mario", "Frasca", email = "mariotomo@gmail.com", role = c("aut")),
person("Walerian", "Sokolowski", email = "r-logging@wlogsolutions.com", role = c("cre"))
person("Mario", "Frasca", email = "mariotomo@gmail.com", role = c("aut", "cre")),
person("Walerian", "Sokolowski", email = "r-logging@wlogsolutions.com", role = c("aut"))
)
Description: Pure R implementation of the ubiquitous log4j package. It offers hierarchic
loggers, multiple handlers per logger, level based filtering, space handling in messages
and custom formatting.
URL: https://github.com/WLOGSolutions/r-logging
URL: https://github.com/mfrasca/r-logging
BugReports: https://github.com/WLOGSolutions/r-logging/issues
License: GPL-3
Encoding: UTF-8
Expand Down
13 changes: 12 additions & 1 deletion pkg/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# logging 1.0-0 (2026-05-25)
- Version 1.0 marks the package as stable; versioning henceforth follows
major.minor-patch where patch is for administrative/documentation fixes
and minor for bug fixes and new features
- Added GitHub Actions workflows for continuous integration.
- Published test coverage on coveralls.io

# logging 0.10-111 (2026-05-21)
- Resumed maintainership (original author Mario Frasca)
- Fixed bug: non-character messages (e.g. Date) now log correctly

# logging 0.10-108 (2019-07-14)
* issue #4: logged do not raise exception if formatting message contains %F
markers and not formatting arguments passed
Expand Down Expand Up @@ -27,4 +38,4 @@
logReset.

# logging 0.8-104 (2018-11-29)
* Maintener changed to Walerian Sokolowski
* Maintainer changed to Walerian Sokolowski
2 changes: 1 addition & 1 deletion pkg/R/logger.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ levellog <- function(level, msg, ..., logger = "") {
#' Set defaults and get the named logger.
#'
#' Make sure a logger with a specific name exists and return it as a
#' \var{Logger} S4 object. if not yet present, the logger will be created and
#' \var{Logger} object. If not yet present, the logger will be created and
#' given the values specified in the \dots arguments.
#'
#' @param name The name of the logger
Expand Down
2 changes: 1 addition & 1 deletion pkg/R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ defaultMsgCompose <- function(msg, ...) {
!(matched_call_names %in% c(setdiff(formal_names, "...")))

label <- lapply(matched_call[is_output_param], deparse)
msg <- sprintf("%s: %s", label, c(msg, optargs))
msg <- sprintf("%s: %s", label, c(as.character(msg), optargs))
return(msg)
}
2 changes: 1 addition & 1 deletion pkg/man/logging-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 32 additions & 3 deletions pkg/tests/testthat/test.handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ test_that("loggingToConsole", {
logReset()
basicConfig()

logdebug("test %d", 2)
loginfo("test %d", 2)
output <- capture.output({
logdebug("test %d", 2)
loginfo("test %d", 2)
})

succeed()
expect_true(any(grepl("test 2", output)))
expect_false(any(grepl("DEBUG", output)))
})

test_that("loggingToFile", {
Expand Down Expand Up @@ -211,3 +214,29 @@ test_that("loggingToFile.oo", {

succeed()
})

test_that("writeToConsole initializes color_msg as identity when color_output=FALSE", {
logReset()
basicConfig()
addHandler(writeToConsole, color_output = FALSE)
handler <- getHandler("writeToConsole")
expect_equal(handler$color_msg("test", "INFO"), "test")
expect_equal(handler$color_msg("test", "ERROR"), "test")
})

test_that("writeToConsole initializes color_msg with level-dependent coloring by default", {
skip_if_not_installed("crayon")
withr::with_options(list(crayon.enabled = TRUE), {
logReset()
basicConfig()
addHandler(writeToConsole)
handler <- getHandler("writeToConsole")
info_msg <- handler$color_msg("test", "INFO")
error_msg <- handler$color_msg("test", "ERROR")
expect_true(grepl("test", info_msg))
expect_true(grepl("test", error_msg))
expect_true(grepl("\033[", info_msg, fixed = TRUE))
expect_true(grepl("\033[", error_msg, fixed = TRUE))
expect_false(identical(info_msg, error_msg))
})
})
3 changes: 3 additions & 0 deletions pkg/tests/testthat/test.msg-composer.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ test_that("msgcomposer/composer_signature_validation_directly", {
})
})

test_that("loginfo handles Date objects without error", {
expect_no_error(loginfo(as.Date("2022-01-01")))
})