Git Product home page Git Product logo

shinyeventlogger's Introduction

shinyEventLogger

Licence Lifecycle Travis build status CRAN Status Monthly downloads badge Daily downloads badge Weekly downloads badge HitCount

by Kamil Wais

Logging Events in Complex Shiny Apps. Logging framework dedicated for complex shiny apps. Different types of events can be logged (character string, value of a variable, multi-line output of a function, result of a unit test, custom error, warning, or diagnostic message). Each event can be logged with a list of parameters that are event-specific, common for a group of events, or common for all app events. Logging can be done simultaneously to R console, browser JavaScript console, a file log, and a database (currently MongoDB). Log data can be further analyzed with the help of process-mining techniques from 'bupaR' package.

Installation

Installing stable version from CRAN

install.packages("shinyEventLogger")

Installing version in development from GitHub

# install.packages('devtools')
devtools::install_github("kalimu/shinyEventLogger")

Demo Apps

Simple app logging different events to R console, browser JavaScript console and to a file.

shinyEventLogger::run_demo()

Dashboard that allows for interactive analysis of events from demo app.

shinyEventLogger::run_demo_dashboard()

Hello World

library(shiny)
library(shinyEventLogger)
set_logging()
shinyApp(
  ui = fluidPage(log_init()),
  server = function(input, output) {
    set_logging_session()
    log_event("Hello World")
 }
)

Executing the code above you should see in the console something like this:

|#1|EVENT|Hello World|FIRED|

Demo Shiny Apps

  • DemoApp -- demo shiny app logging different types of events.
  • DashboardApp -- demo dashboard showing examples how logged events from the DemoApp can be analyzed

Documentation

Package docs (pkgdown): https://kalimu.github.io/shinyEventLogger/index.html

Project description (on homepage): https://kalimu.github.io/project/shinyeventlogger/

For other logging packages see: https://github.com/daroczig/logger

shinyeventlogger's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shinyeventlogger's Issues

Change timezone of timestamp

Hi everyone,
this might be a really basic question, but I am wondering if it is possible to change the timezone for the timestamp in logged events that are sent to a file.

Thanks in advance.

CRAN failure

Hi, currently the package is no longer available on CRAN due to some check results errors
Do you plan on fixing those? My packages partially depend on yours, so I would need to carve it out otherwise.
Thanks for your work! Keep it up! :)

Allow to natively use cat_where during dev

First of all, nice work!

How would you feel about natively add a wrapper around {whereami} for dev logs?

I've been using whereami::cat_where() for logging from which file the event is fired during dev.

It definitely help to find back where to go for debugging.

So for example log_event("Hello World") would output

|#1|EVENT|Hello World|FIRED|
|#1|WHERE|observeEvent(...) at R/mod_bla#123|

https://github.com/yonicd/whereami

ping @yonicd

Failure with dev testthat

── FAILURE (???): logging wrapper functions ────────────────────────────────────
`log_test(expect_true(FALSE))` does not match "|#2|Error: FALSE isn't true.".
Actual value: "|#2|Error: FALSE is not TRUE`actual`:   FALSE`expected`: TRUE "

This is probably because expect_true() now produces a different error message; maybe you want to use expect_failure() instead?

I'll be submitting testthat to CRAN in about a month.

Error when using r_console FALSE

Warning: Error in log_event: object 'result_r_console' not found

when i try to run log_started("log") - when i have set r_consol=false set_logging(r_console = FALSE)

Add an option to keep log body / params in log_value

Currently when you use for example log_value header of log just tells you that value is being logged, but actual value is sent to params, which is discarded from Shiny Server Error Logs (/var/log/shiny-server/*.log). It would be great to have an option to keep them - not on only in case of log_value, but in general.

log_started/log_done unit is incorrect

The current units of task duration is always set to "secs".

set_logging(js_console = FALSE)
shinyApp(
ui = shiny::fluidPage(),
server = function(input, output) {
set_logging_session()
log_started("Event 1")
Sys.sleep(1)
log_started("Event 2")
Sys.sleep(120)
log_done("Event 2")
Sys.sleep(1)
log_done("Event 1")
}
)

|#1|EVENT|Event 1|STARTED|
|#2|EVENT|Event 2|STARTED|
|#2|EVENT|Event 2|DONE|
|#2|PARAMS|list(secs = 2.03)
|#1|EVENT|Event 1|DONE|
|#1|PARAMS|list(secs = 2.07)

Logger timestamp at beginning of line

When logging to file, would it be possible to move the timestamp (currently the last column) to be the first column of each entry? I think it would make the log file more visually consistent, and easier to use when debugging. Thanks!

Allow JSON format for log file?

Thank you so much for creating this package! I am very interested in trying this out in some large Shiny apps. Would it be possible to write the log files as JSON format in addition to the current "tabular" format that's currently offered? I would like to augment this with another logging package called logger and be able to use JSON as a standard file format for each type. That would also play nicely with some additional testing workflows with shinytest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.