Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dreamRs/shinylogs

Logs for Shiny apps
https://github.com/dreamRs/shinylogs

logs r shiny shinyapps

Last synced: about 1 month ago
JSON representation

Logs for Shiny apps

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# shinylogs

> Logging tool for Shiny applications: record inputs or outputs changes, and infos about user's session. All recording is done client-side to not slow down the application and occupy the server.

[![version](http://www.r-pkg.org/badges/version/shinylogs)](https://CRAN.R-project.org/package=shinylogs)
[![cran checks](https://cranchecks.info/badges/worst/shinylogs)](https://cranchecks.info/pkgs/shinylogs)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![Project Status: Active The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Codecov test coverage](https://codecov.io/gh/dreamRs/shinylogs/branch/master/graph/badge.svg)](https://app.codecov.io/gh/dreamRs/shinylogs?branch=master)
[![R build status](https://github.com/dreamRs/shinylogs/workflows/R-CMD-check/badge.svg)](https://github.com/dreamRs/shinylogs/actions)

## Installation

You can install the released version of shinylogs from [CRAN](https://CRAN.R-project.org/package=shinylogs) with:

```r
install.packages("shinylogs")
```

And the development version from [GitHub](https://github.com/dreamRs/shinylogs) with:

```r
# install.packages("remotes")
remotes::install_github("dreamRs/shinylogs")
```

## Usage

Call the main function `track_usage` in server part of application, and specify where to write logs:

```{r example, eval=FALSE}
library(shinylogs)

track_usage(storage_mode = store_json(path = "logs/"))
```

The function will record :

* *inputs* : each time an input change, name, timestamp and value will be saved
* *errors* : errors propagated through outputs
* *outputs* : each time an output is re-generated
* *session* : informations about user's browser and the application

See the vignette for more details (` ?vignette("shinylogs")`) or the [online version](https://dreamrs.github.io/shinylogs/articles/shinylogs.html).

## Examples

Some example of what is recorded with logs from applications available on our Shiny-Server: http://shinyapps.dreamrs.fr/

Number of connections per applications:

```{r, echo=FALSE}
knitr::include_graphics("man/figures/connections-apps.png")
```

Number of connections over time :

```{r, echo=FALSE}
knitr::include_graphics("man/figures/connections-day.png")
```

Which tabs (from sidebar in {shinydashboard}) in [shinyWidgets](https://github.com/dreamRs/shinyWidgets) gallery are the most seen :

```{r, echo=FALSE}
knitr::include_graphics("man/figures/shinyWidgets-tabs.png")
```

User-agent is recorded per connection and can be parsed with [uaparserjs](https://github.com/hrbrmstr/uaparserjs) :
(unique users are not registered as we use the open source version of shiny-server)

```{r, echo=FALSE}
knitr::include_graphics("man/figures/ua-family.png")
knitr::include_graphics("man/figures/ua-os.png")
```

## Development

This package use [{packer}](https://github.com/JohnCoene/packer) to manage JavaScript assets, see packer's [documentation](https://packer.john-coene.com/#/) for more.

Install nodes modules with:

```r
packer::npm_install()
```

Modify `srcjs/exts/shinylogs.js`, then run:

```r
packer::bundle()
```

Re-install R package and try `track_usage()` function.