Logs for Shiny apps
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
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.
You can install the released version of shinylogs from CRAN with:
install.packages("shinylogs")
And the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("dreamRs/shinylogs")
Call the main function track_usage
in server part of application, and specify where to write logs:
library(shinylogs)
track_usage(storage_mode = store_json(path = "logs/"))
The function will record :
See the vignette for more details ( ?vignette("shinylogs")
) or the online version.
Some example of what is recorded with logs from applications available on our Shiny-Server: http://shinyapps.dreamrs.fr/
Number of connections per applications:
knitr::include_graphics("man/figures/connections-apps.png")
Number of connections over time :
knitr::include_graphics("man/figures/connections-day.png")
Which tabs (from sidebar in {shinydashboard}) in shinyWidgets gallery are the most seen :
knitr::include_graphics("man/figures/shinyWidgets-tabs.png")
User-agent is recorded per connection and can be parsed with uaparserjs :
(unique users are not registered as we use the open source version of shiny-server)
knitr::include_graphics("man/figures/ua-family.png")
knitr::include_graphics("man/figures/ua-os.png")
This package use {packer} to manage JavaScript assets, see packer’s documentation for more.
Install nodes modules with:
packer::npm_install()
Modify srcjs/exts/shinylogs.js
, then run:
packer::bundle()
Re-install R package and try track_usage()
function.