-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathREADME.Rmd
117 lines (74 loc) · 3.49 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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.
<!-- badges: start -->
[![version](https://www.r-pkg.org/badges/version/shinylogs)](https://CRAN.R-project.org/package=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-CMD-check](https://github.com/dreamRs/shinylogs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dreamRs/shinylogs/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
## 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.