Record Everything that Happens in a 'Shiny' Application

Track and record the use of applications and the user's interactions with 'Shiny' inputs. Allow to save inputs clicked, output generated and eventually errors.


Travis build status Lifecycle: maturing

Installation

You can install from GitHub:

remotes::install_github("dreamRs/shinylogs")

Usage

Call track_usage in your server function, it 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 the browser and the application

New inputs are created to expose those data, you can access them with .shinylogs_input, .shinylogs_error, .shinylogs_output and .shinylogs_browserData. An additional input is also created to expose the last input modified by the user: .shinylogs_lastInput.

When application is closed (in fact on session ended), a JSON is created in a subfolder of app's directory.

Example:

# Shiny server
function(input, output, session) {
 
  track_usage(storage_mode = store_json(path = "logs/"))
  
}

Example of JSON created (with the Kmeans example app)

{
   "inputs":[
      {
         "name":"ycol",
         "timestamp":"2019-04-07T13:39:40+02:00",
         "value":"Sepal.Width",
         "type":"",
         "binding":"shiny.selectInput"
      },
      {
         "name":"ycol",
         "timestamp":"2019-04-07T13:39:35+02:00",
         "value":"Petal.Width",
         "type":"",
         "binding":"shiny.selectInput"
      },
      {
         "name":"clusters",
         "timestamp":"2019-04-07T13:39:37+02:00",
         "value":5,
         "type":"shiny.number",
         "binding":"shiny.numberInput"
      },
      {
         "name":"xcol",
         "timestamp":"2019-04-07T13:39:33+02:00",
         "value":"Sepal.Length",
         "type":"",
         "binding":"shiny.selectInput"
      },
      {
         "name":"clusters",
         "timestamp":"2019-04-07T13:39:37+02:00",
         "value":4,
         "type":"shiny.number",
         "binding":"shiny.numberInput"
      },
      {
         "name":"ycol",
         "timestamp":"2019-04-07T13:39:38+02:00",
         "value":"Species",
         "type":"",
         "binding":"shiny.selectInput"
      },
      {
         "name":"clusters",
         "timestamp":"2019-04-07T13:39:37+02:00",
         "value":5,
         "type":"shiny.number",
         "binding":"shiny.numberInput"
      },
      {
         "name":"xcol",
         "timestamp":"2019-04-07T13:39:32+02:00",
         "value":"Sepal.Width",
         "type":"",
         "binding":"shiny.selectInput"
      }
   ],
   "errors":[
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:39+02:00",
         "error":"NA/NaN/Inf in foreign function call (arg 1)"
      }
   ],
   "outputs":[
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:41+02:00",
         "binding":"shiny.imageOutput"
      },
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:35+02:00",
         "binding":"shiny.imageOutput"
      },
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:33+02:00",
         "binding":"shiny.imageOutput"
      },
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:37+02:00",
         "binding":"shiny.imageOutput"
      },
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:32+02:00",
         "binding":"shiny.imageOutput"
      },
      {
         "name":"plot1",
         "timestamp":"2019-04-07T13:39:37+02:00",
         "binding":"shiny.imageOutput"
      }
   ],
   "session":[
      {
         "app":"kmeans-example",
         "user":"pvictor",
         "server_connected":"2019-04-07T13:39:30+0200",
         "sessionid":"e32af32f5b664b6db175aaac1e0cd70a",
         "server_disconnected":"2019-04-07T13:39:42+0200",
         "user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
         "screen_res":"1920x1080",
         "browser_res":"1273x909",
         "pixel_ratio":1,
         "browser_connected":"2019-04-07T13:39:31+02:00"
      }
   ]
}

News

shinylogs 0.1.3

  • First release : Track and record the use of applications and the user's interactions with 'Shiny' inputs. Allow to save inputs clicked, output generated and eventually errors.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("shinylogs")

0.1.5 by Victor Perrier, 11 days ago


https://github.com/dreamRs/shinylogs


Report a bug at https://github.com/dreamRs/shinylogs/issues


Browse source code at https://github.com/cran/shinylogs


Authors: Fanny Meyer [aut] , Victor Perrier [aut, cre] , Silex Technologies [fnd] (https://www.silex-ip.com) , iamkun [cph] (dayjs library) , Mozilla [cph] (localForage library)


Documentation:   PDF Manual  


GPL-3 license


Imports htmltools, shiny, jsonlite, data.table, bit64, nanotime, digest, anytime, DBI, RSQLite

Suggests testthat


See at CRAN