From ea1e0b0a5cbf003fe091ca990f518b80d7fcfe84 Mon Sep 17 00:00:00 2001 From: MEO265 <99362508+MEO265@users.noreply.github.com> Date: Sun, 12 May 2024 20:48:49 +0200 Subject: [PATCH] Add gh-pages web page (#74) --- .Rbuildignore | 3 ++ .github/workflows/pkgdown.yaml | 50 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + DESCRIPTION | 2 +- NEWS.md | 2 +- README.Rmd | 3 +- README.md | 26 ++++++++---------- _pkgdown.yml | 43 +++++++++++++++++++++++++++++ 8 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/pkgdown.yaml create mode 100644 _pkgdown.yml diff --git a/.Rbuildignore b/.Rbuildignore index 915bb8e..858b157 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,3 +13,6 @@ Makefile ^\.github$ ^\.covrignore$ ^\.idea$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..c9f0165 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages πŸš€ + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 04dfa6c..84ec442 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ README.* inst/doc Dockerfile .idea +docs diff --git a/DESCRIPTION b/DESCRIPTION index 2eddc20..bfc91de 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ Suggests: rmarkdown (>= 1.8), testthat (>= 3.0.0), utils -URL: https://github.com/MEO265/loggit2 +URL: https://github.com/MEO265/loggit2, http://www.r-loggit.org/ BugReports: https://github.com/MEO265/loggit2/issues RoxygenNote: 7.3.0 Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index 7f7c1b9..e9d5216 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# loggit2 DEV +# loggit2 (development version) ## Breaking changes * Custom `sanitizer`s and `unsanitizer`s are no longer supported. This decision was made because no active diff --git a/README.Rmd b/README.Rmd index 50602f3..7d3bd1c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -24,9 +24,8 @@ Easy-to-use, dependencyless Logger for R [![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/loggit2)](https://cran.r-project.org/package=loggit2) [![R-CMD-check](https://github.com/MEO265/loggit2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MEO265/loggit2/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/MEO265/loggit2/graph/badge.svg)](https://codecov.io/gh/MEO265/loggit2) - - ------------------------------------------------------------------------ + `loggit2` is an easy-to-use [`ndJSON`](https://github.com/ndjson/ndjson-spec) logging library for R software, with _zero_ external dependencies. diff --git a/README.md b/README.md index 45aa162..b95e44b 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@ [![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/loggit2)](https://cran.r-project.org/package=loggit2) [![R-CMD-check](https://github.com/MEO265/loggit2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MEO265/loggit2/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/MEO265/loggit2/graph/badge.svg)](https://codecov.io/gh/MEO265/loggit2) - - ------------------------------------------------------------------------- +β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” `loggit2` is an easy-to-use [`ndJSON`](https://github.com/ndjson/ndjson-spec) logging library for R @@ -44,13 +42,13 @@ at the desired locations. ``` r loggit2::message("This is a message") -#> {"timestamp": "2024-05-03T21:30:47+0200", "log_lvl": "INFO", "log_msg": "This is a message__LF__"} +#> {"timestamp": "2024-05-12T20:39:08+0200", "log_lvl": "INFO", "log_msg": "This is a message__LF__"} #> This is a message loggit2::warning("This is a warning") -#> {"timestamp": "2024-05-03T21:30:47+0200", "log_lvl": "WARN", "log_msg": "This is a warning"} +#> {"timestamp": "2024-05-12T20:39:08+0200", "log_lvl": "WARN", "log_msg": "This is a warning"} #> Warning: This is a warning loggit2::stop("This is an error") -#> {"timestamp": "2024-05-03T21:30:47+0200", "log_lvl": "ERROR", "log_msg": "This is an error"} +#> {"timestamp": "2024-05-12T20:39:08+0200", "log_lvl": "ERROR", "log_msg": "This is an error"} #> Error in eval(expr, envir, enclos): This is an error ``` @@ -83,18 +81,18 @@ it’ll become a structured log. ``` r loggit2::loggit("ERROR", "This will log an error", anything_else = "you want to include") -#> {"timestamp": "2024-05-03T21:30:47+0200", "log_lvl": "ERROR", "log_msg": "This will log an error", "anything_else": "you want to include"} +#> {"timestamp": "2024-05-12T20:39:08+0200", "log_lvl": "ERROR", "log_msg": "This will log an error", "anything_else": "you want to include"} # Read log file into data frame to implement logic based on entries loggit2::read_logs() #> timestamp log_lvl log_msg anything_else -#> 1 2024-05-03T21:30:47+0200 INFO This is a message\n -#> 2 2024-05-03T21:30:47+0200 WARN This is a warning -#> 3 2024-05-03T21:30:47+0200 ERROR This is an error -#> 4 2024-05-03T21:30:47+0200 INFO This is another message\n -#> 5 2024-05-03T21:30:47+0200 WARN This is another warning -#> 6 2024-05-03T21:30:47+0200 ERROR This is another error -#> 7 2024-05-03T21:30:47+0200 ERROR This will log an error you want to include +#> 1 2024-05-12T20:39:08+0200 INFO This is a message\n +#> 2 2024-05-12T20:39:08+0200 WARN This is a warning +#> 3 2024-05-12T20:39:08+0200 ERROR This is an error +#> 4 2024-05-12T20:39:08+0200 INFO This is another message\n +#> 5 2024-05-12T20:39:08+0200 WARN This is another warning +#> 6 2024-05-12T20:39:08+0200 ERROR This is another error +#> 7 2024-05-12T20:39:08+0200 ERROR This will log an error you want to include ``` Check out the diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..fecb912 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,43 @@ +url: http://www.r-loggit.org/ + +home: + title: Easy-to-Use, Dependencyless Logger for R + sidebar: + structure: [links, license, dev] + +template: + bootstrap: 5 + +reference: + - title: Handlers + - contents: + - "message" + - "warning" + - "stop" + - "stopifnot" + - title: Working horses + - contents: + - "loggit" + - "with_loggit" + - title: Utility functions + - contents: + - "read_logs" + - "rotate_logs" + - "convert_to_csv" + - title: Configuration + - contents: + - starts_with("set_") + - starts_with("get_") + +development: + mode: auto + +navbar: + structure: + left: [intro, reference, articles, news] + right: github + +footer: + structure: + left: package + right: developed_by