Skip to content

Commit

Permalink
Add gh-pages web page (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
MEO265 authored May 12, 2024
1 parent d62af38 commit ea1e0b0
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ Makefile
^\.github$
^\.covrignore$
^\.idea$
^_pkgdown\.yml$
^docs$
^pkgdown$
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ README.*
inst/doc
Dockerfile
.idea
docs
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<!-- badges: end -->

------------------------------------------------------------------------
<!-- badges: end -->

`loggit2` is an easy-to-use [`ndJSON`](https://github.com/ndjson/ndjson-spec) logging library for R software,
with _zero_ external dependencies.
Expand Down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<!-- badges: end -->

------------------------------------------------------------------------
———————————————————————— <!-- badges: end -->

`loggit2` is an easy-to-use
[`ndJSON`](https://github.com/ndjson/ndjson-spec) logging library for R
Expand Down Expand Up @@ -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
```

Expand Down Expand Up @@ -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 <NA>
#> 2 2024-05-03T21:30:47+0200 WARN This is a warning <NA>
#> 3 2024-05-03T21:30:47+0200 ERROR This is an error <NA>
#> 4 2024-05-03T21:30:47+0200 INFO This is another message\n <NA>
#> 5 2024-05-03T21:30:47+0200 WARN This is another warning <NA>
#> 6 2024-05-03T21:30:47+0200 ERROR This is another error <NA>
#> 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 <NA>
#> 2 2024-05-12T20:39:08+0200 WARN This is a warning <NA>
#> 3 2024-05-12T20:39:08+0200 ERROR This is an error <NA>
#> 4 2024-05-12T20:39:08+0200 INFO This is another message\n <NA>
#> 5 2024-05-12T20:39:08+0200 WARN This is another warning <NA>
#> 6 2024-05-12T20:39:08+0200 ERROR This is another error <NA>
#> 7 2024-05-12T20:39:08+0200 ERROR This will log an error you want to include
```

Check out the
Expand Down
43 changes: 43 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ea1e0b0

Please sign in to comment.