From f633f9e1dfd9c42d9c210d939fcaa5a1c0aeb6b8 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Thu, 21 May 2026 16:38:18 +0200 Subject: [PATCH 01/26] stating myself back as maintainer --- pkg/DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 0667e0c..68e6662 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -1,9 +1,9 @@ Package: logging -Version: 0.10-108 +Version: 0.10-109 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 From ec45c0edb47cde46f3874b2b18e57ae65bacb562 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Thu, 21 May 2026 16:39:17 +0200 Subject: [PATCH 02/26] fixing a moved reference page --- pkg/DESCRIPTION | 2 +- pkg/man/logging-package.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 68e6662..9c47519 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -1,5 +1,5 @@ Package: logging -Version: 0.10-109 +Version: 0.10-110 Title: R Logging Package Authors@R: c( person("Mario", "Frasca", email = "mariotomo@gmail.com", role = c("aut", "cre")), diff --git a/pkg/man/logging-package.Rd b/pkg/man/logging-package.Rd index 5cb6eee..d585fa6 100644 --- a/pkg/man/logging-package.Rd +++ b/pkg/man/logging-package.Rd @@ -46,7 +46,7 @@ The web pages for this package on r-forge are kept decently up to date and contain a usable tutorial. Check the references. } \references{ -the python logging module: \url{http://docs.python.org/library/logging.html}\cr +the python logging module: \url{https://docs.python.org/3/library/logging.html}\cr this package at github: \url{https://github.com/WLOGSolutions/r-logging/} } \keyword{package} From 36196997ee5602596dc60ad0a7f0b254caebe8e0 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Thu, 21 May 2026 16:40:04 +0200 Subject: [PATCH 03/26] issue 29: failure to log dates. --- pkg/DESCRIPTION | 2 +- pkg/R/utils.R | 2 +- pkg/tests/testthat/test.msg-composer.R | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 9c47519..18255c8 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -1,5 +1,5 @@ Package: logging -Version: 0.10-110 +Version: 0.10-111 Title: R Logging Package Authors@R: c( person("Mario", "Frasca", email = "mariotomo@gmail.com", role = c("aut", "cre")), diff --git a/pkg/R/utils.R b/pkg/R/utils.R index ba5ddb0..b4ec308 100644 --- a/pkg/R/utils.R +++ b/pkg/R/utils.R @@ -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) } diff --git a/pkg/tests/testthat/test.msg-composer.R b/pkg/tests/testthat/test.msg-composer.R index a038568..bbffaf8 100644 --- a/pkg/tests/testthat/test.msg-composer.R +++ b/pkg/tests/testthat/test.msg-composer.R @@ -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"))) +}) From 52628e9f06205d9b466d65a2f0a041a9c20660d4 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Fri, 22 May 2026 12:39:38 +0200 Subject: [PATCH 04/26] bumping to 1.0-0, adding github workflows for ci. --- .github/workflows/R-CMD-check.yaml | 37 ++++++++++++++++++++++++++++++ .gitignore | 3 +++ pkg/DESCRIPTION | 2 +- pkg/NEWS.md | 10 +++++++- 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..ba7633f --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,37 @@ +# 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: + os: [ubuntu-latest, macos-latest, windows-latest] + r-version: ['release', 'devel'] + steps: + - uses: actions/checkout@v4 + - name: Set up R ${{ matrix.r-version }} + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.r-version }} + - name: Install dependencies + run: | + install.packages(c("remotes", "rcmdcheck")) + remotes::install_deps(dependencies = TRUE) + shell: Rscript {0} + - name: Check + run: rcmdcheck::rcmdcheck(args = "--as-cran", error_on = "error") + shell: Rscript {0} diff --git a/.gitignore b/.gitignore index f7267d5..83255b1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ pkg.Rcheck .Rproj.user report.xml +/logging.Rcheck/ +/logging_*.tar.gz +/pkg/tests/testthat/_problems/ diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 18255c8..6591044 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -1,5 +1,5 @@ Package: logging -Version: 0.10-111 +Version: 1.0-0 Title: R Logging Package Authors@R: c( person("Mario", "Frasca", email = "mariotomo@gmail.com", role = c("aut", "cre")), diff --git a/pkg/NEWS.md b/pkg/NEWS.md index 06f08df..85d0ad5 100644 --- a/pkg/NEWS.md +++ b/pkg/NEWS.md @@ -1,3 +1,11 @@ +1.0-0 (2026-05-xx) + - Resumed maintainership (original author Mario Frasca) + - Fixed bug: non-character messages (e.g. Date) now log correctly + - 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 (R-CMD-check) + # 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 @@ -27,4 +35,4 @@ logReset. # logging 0.8-104 (2018-11-29) - * Maintener changed to Walerian Sokolowski + * Maintainer changed to Walerian Sokolowski From bd4fa8c246b797d0ebfece1c24003de3fd688b93 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Fri, 22 May 2026 12:45:37 +0200 Subject: [PATCH 05/26] getting github CI workflows to work. --- .github/workflows/R-CMD-check.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index ba7633f..6e616b9 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -32,6 +32,8 @@ jobs: install.packages(c("remotes", "rcmdcheck")) remotes::install_deps(dependencies = TRUE) shell: Rscript {0} + working-directory: pkg - name: Check run: rcmdcheck::rcmdcheck(args = "--as-cran", error_on = "error") shell: Rscript {0} + working-directory: pkg From f229272b59825d54eb8e7324b996c4479734fc9a Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Fri, 22 May 2026 12:51:54 +0200 Subject: [PATCH 06/26] getting github CI workflows to work. --- .github/workflows/R-CMD-check.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 6e616b9..9089e3e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,6 +23,9 @@ jobs: r-version: ['release', 'devel'] steps: - uses: actions/checkout@v4 + - name: Install system dependencies + if: runner.os == 'Linux' + run: sudo apt-get install -y libcurl4-openssl-dev - name: Set up R ${{ matrix.r-version }} uses: r-lib/actions/setup-r@v2 with: @@ -34,6 +37,6 @@ jobs: shell: Rscript {0} working-directory: pkg - name: Check - run: rcmdcheck::rcmdcheck(args = "--as-cran", error_on = "error") + run: rcmdcheck::rcmdcheck(args = "--as-cran", "--no-manual", error_on = "error") shell: Rscript {0} working-directory: pkg From ecf15d54a5b8e7ac3bd1859cfab75c877a0243c8 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Fri, 22 May 2026 12:56:15 +0200 Subject: [PATCH 07/26] getting github CI workflows to work. --- .github/workflows/R-CMD-check.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9089e3e..ad9a886 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -37,6 +37,5 @@ jobs: shell: Rscript {0} working-directory: pkg - name: Check - run: rcmdcheck::rcmdcheck(args = "--as-cran", "--no-manual", error_on = "error") + run: rcmdcheck::rcmdcheck("pkg", args = c("--as-cran", "--no-manual"), error_on = "error") shell: Rscript {0} - working-directory: pkg From 812c1b94ea8f70a49c0cf85af89641b6907a20d2 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Fri, 22 May 2026 13:02:26 +0200 Subject: [PATCH 08/26] getting github CI workflows to work. --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index ad9a886..a2a2edc 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -32,7 +32,7 @@ jobs: r-version: ${{ matrix.r-version }} - name: Install dependencies run: | - install.packages(c("remotes", "rcmdcheck")) + install.packages(c("remotes", "rcmdcheck", "testthat")) remotes::install_deps(dependencies = TRUE) shell: Rscript {0} working-directory: pkg From 943053eb9684eb732709468d32358745c81563f6 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 08:32:38 +0200 Subject: [PATCH 09/26] getting github CI workflows to work. invece di riprogrammare gli 'step', utilizza azioni predefinite, con la semplice indicazione dei parametri corretti. --- .github/workflows/R-CMD-check.yaml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a2a2edc..d984740 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -26,16 +26,14 @@ jobs: - name: Install system dependencies if: runner.os == 'Linux' run: sudo apt-get install -y libcurl4-openssl-dev - - name: Set up R ${{ matrix.r-version }} - uses: r-lib/actions/setup-r@v2 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.r-version }} - - name: Install dependencies - run: | - install.packages(c("remotes", "rcmdcheck", "testthat")) - remotes::install_deps(dependencies = TRUE) - shell: Rscript {0} - working-directory: pkg - - name: Check - run: rcmdcheck::rcmdcheck("pkg", args = c("--as-cran", "--no-manual"), error_on = "error") - shell: Rscript {0} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + working-directory: pkg + - uses: r-lib/actions/check-r-package@v2 + with: + working-directory: pkg + args: 'c("--as-cran", "--no-manual")' + error-on: '"error"' From a20b20b9d4ba9f931c37add5f17b9734e32d206e Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 08:37:46 +0200 Subject: [PATCH 10/26] getting github CI workflows to work. bisogna aggiungere una libreria necessaria per il workflow, non presente nelle dipendenze della 'logging'. --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d984740..a7fddc5 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -32,6 +32,7 @@ jobs: - 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 From 9709d16d97d1eae00b9ee5ffc2efd6795e121cfe Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 08:54:13 +0200 Subject: [PATCH 11/26] added test-coverage workflow --- .github/workflows/test-coverage.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..5f1d71a --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,27 @@ +name: test-coverage +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] +permissions: + contents: read +jobs: + test-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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::coveralls + - name: Test coverage + run: covr::coveralls(path = "pkg", service = "github") + shell: Rscript {0} + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 280ddfd3dc6b00922de05ea1611ea1a0713b5952 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 08:56:47 +0200 Subject: [PATCH 12/26] getting github CI test-coverage workflow to work. --- .github/workflows/test-coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 5f1d71a..9b31902 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -19,7 +19,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: working-directory: pkg - extra-packages: any::covr, any::coveralls + extra-packages: any::covr - name: Test coverage run: covr::coveralls(path = "pkg", service = "github") shell: Rscript {0} From 15da27724fe78161cebe58adabc19045156221f4 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 09:31:25 +0200 Subject: [PATCH 13/26] getting github CI test-coverage workflow to work. --- .github/workflows/test-coverage.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 9b31902..6104acb 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -4,24 +4,40 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] -permissions: - contents: read + +permissions: read-all + jobs: test-coverage: runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - - uses: actions/checkout@v4 + - 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 + needs: coverage + - name: Test coverage run: covr::coveralls(path = "pkg", service = "github") shell: Rscript {0} env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash From b567784e968b136ea62bb932707a7ee1a6061e2a Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 09:40:24 +0200 Subject: [PATCH 14/26] getting github CI test-coverage workflow to work. --- .github/workflows/test-coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 6104acb..3b72845 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -33,7 +33,7 @@ jobs: run: covr::coveralls(path = "pkg", service = "github") shell: Rscript {0} env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - name: Show testthat output if: always() From 62796c9470bd3df644da808a6b382bee0522359c Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 10:00:48 +0200 Subject: [PATCH 15/26] getting github CI test-coverage workflow to work. --- .github/workflows/test-coverage.yaml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 3b72845..422af7d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -26,18 +26,28 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: working-directory: pkg - extra-packages: any::covr + extra-packages: any::covr, any::xml2 needs: coverage - - name: Test coverage - run: covr::coveralls(path = "pkg", service = "github") + - 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 env: - COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - name: Show testthat output if: always() run: | ## -------------------------------------------------------------------- - find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + find "${{ runner.temp }}/package" -name "testthat.Rout*" -exec cat "{}" \; || true shell: bash From b794e03803f0932f46e483232e10c25cfce78a7f Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 10:09:34 +0200 Subject: [PATCH 16/26] added base path, possibly needed to show source files in coveralls --- .github/workflows/test-coverage.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 422af7d..ea72292 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -42,6 +42,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} file: cobertura.xml format: cobertura + base-path: pkg env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} From 3d3bb07946735e8e1c7d6dae02fd6b3bfb44395e Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 14:42:17 +0200 Subject: [PATCH 17/26] update NEWS, stating new 1.0-0 version, plus workflows. --- pkg/NEWS.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/NEWS.md b/pkg/NEWS.md index 85d0ad5..fce1f2b 100644 --- a/pkg/NEWS.md +++ b/pkg/NEWS.md @@ -1,10 +1,13 @@ -1.0-0 (2026-05-xx) - - Resumed maintainership (original author Mario Frasca) - - Fixed bug: non-character messages (e.g. Date) now log correctly +# 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 (R-CMD-check) + - 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 From 832d28c767b89af60b1085ae25180a640e9b47b2 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 14:55:49 +0200 Subject: [PATCH 18/26] updated installation description, corrected repository link. --- README.md | 20 ++++++++++++++++++-- pkg/DESCRIPTION | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index acd858e..8500723 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,23 @@ 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") +``` + + + +[![Codecov test coverage](https://codecov.io/gh/mfrasca/r-logging/graph/badge.svg)](https://app.codecov.io/gh/mfrasca/r-logging) + diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 6591044..63ba21f 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -8,7 +8,7 @@ Authors@R: c( 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 From ee59321e4bf6568a69ea24fba1207d73d3cced85 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 15:44:33 +0200 Subject: [PATCH 19/26] rimossa variabile globale non utilizzata --- .github/workflows/test-coverage.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index ea72292..cb36d35 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -10,8 +10,6 @@ permissions: read-all jobs: test-coverage: runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v6 From 2e7ff748f3590ff1b1edfeef8f2c6da8c2155d77 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 15:54:40 +0200 Subject: [PATCH 20/26] due file generati, ma utili. --- .Rbuildignore | 1 + .github/.gitignore | 1 + 2 files changed, 2 insertions(+) create mode 100644 .Rbuildignore create mode 100644 .github/.gitignore diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..c503c4f --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1 @@ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html From fa8b552212c8b5d2315a21c7e13adb4176a6f510 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 16:01:25 +0200 Subject: [PATCH 21/26] aggiunto test con oldrel, rimossi devel da windows e macos. --- .github/workflows/R-CMD-check.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a7fddc5..1c207c7 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -19,8 +19,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - r-version: ['release', 'devel'] + 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 From dc96020ceb37b5d9bb7fa9f13afaf1eded78165e Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 16:54:47 +0200 Subject: [PATCH 22/26] rimosso output spurio, migliorato test --- pkg/tests/testthat/test.handlers.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/tests/testthat/test.handlers.R b/pkg/tests/testthat/test.handlers.R index 66c4ac2..4a8e63a 100644 --- a/pkg/tests/testthat/test.handlers.R +++ b/pkg/tests/testthat/test.handlers.R @@ -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", { From b876f8bad4b67763bcba882a617529859e932cbb Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 16:55:06 +0200 Subject: [PATCH 23/26] aggiunti test per output colorato --- pkg/tests/testthat/test.handlers.R | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkg/tests/testthat/test.handlers.R b/pkg/tests/testthat/test.handlers.R index 4a8e63a..bd68b4b 100644 --- a/pkg/tests/testthat/test.handlers.R +++ b/pkg/tests/testthat/test.handlers.R @@ -214,3 +214,33 @@ test_that("loggingToFile.oo", { succeed() }) + +test_that("writeToConsole initializes color_msg as identity when color_output=FALSE", { + # addHandler invokes the action in 'dry' mode to initialize the handler. + # We verify that the resulting color_msg function is the identity, + # i.e. it returns the message unchanged regardless of level. + 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", { + # addHandler invokes the action in 'dry' mode to initialize the handler. + # With crayon available, color_msg should return ANSI-colored strings, + # different for different log levels. + skip_if_not_installed("crayon") + 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)) +}) From 02bdf57c382d499f2fbaa3568975cc921aee2c4d Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 17:04:59 +0200 Subject: [PATCH 24/26] ripuliti i due test sui colori, forzano console colorante. --- pkg/tests/testthat/test.handlers.R | 44 ++++++++++++++---------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/pkg/tests/testthat/test.handlers.R b/pkg/tests/testthat/test.handlers.R index bd68b4b..4475d2b 100644 --- a/pkg/tests/testthat/test.handlers.R +++ b/pkg/tests/testthat/test.handlers.R @@ -216,31 +216,27 @@ test_that("loggingToFile.oo", { }) test_that("writeToConsole initializes color_msg as identity when color_output=FALSE", { - # addHandler invokes the action in 'dry' mode to initialize the handler. - # We verify that the resulting color_msg function is the identity, - # i.e. it returns the message unchanged regardless of level. - 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") + 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", { - # addHandler invokes the action in 'dry' mode to initialize the handler. - # With crayon available, color_msg should return ANSI-colored strings, - # different for different log levels. - skip_if_not_installed("crayon") - 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)) + 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)) + }) }) From 7ac56ce2c2dad605686954287c77414f5ed01ab8 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Mon, 25 May 2026 17:25:54 +0200 Subject: [PATCH 25/26] corretti i badges --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8500723..3021808 100644 --- a/README.md +++ b/README.md @@ -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 ========= @@ -45,6 +45,3 @@ devtools::install_local("BASE/r-logging/pkg") ``` - -[![Codecov test coverage](https://codecov.io/gh/mfrasca/r-logging/graph/badge.svg)](https://app.codecov.io/gh/mfrasca/r-logging) - From ff597dcc28766ae8baf746db7237ba024ddf7a46 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Wed, 27 May 2026 09:00:38 +0200 Subject: [PATCH 26/26] removed not-completely-correct type description. a `Logger` is a Reference Class object, internally implemented as S4. such depth of detail isn't really necessary at this point, so better just stay generic and state that a `Logger` is an object. --- pkg/R/logger.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/R/logger.R b/pkg/R/logger.R index 49ad5e3..29fe81c 100644 --- a/pkg/R/logger.R +++ b/pkg/R/logger.R @@ -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