set_logging: Settings for event logging

Description Usage Arguments Details See Also Examples

View source: R/set_logging.R

Description

set_logging should be used outside ui and server functions, possibly in global.R, to be used only once to define where the logging should be done. Events can be sent to R console, browser JavaScript console, a eventlog file, or a database (or any combination of these). By default logging is done to the R console and JavaScript console. set_logging also can be used to define global event parameters - named objects passed to ... that will be evaluated and added to lists of parameters of all events.

Usage

1
2
set_logging(r_console = TRUE, js_console = TRUE, file = FALSE,
  database = FALSE, ...)

Arguments

r_console

A logical. Should events be logged into R console? Default is TRUE.

js_console

A logical. Should events be logged into browser JavaScript console? Default is TRUE.

file

A logical or a character string. Should events be logged to a file? Default is FALSE. If TRUE the default eventlog filename is "events.log". If character string, path and name of the filelog.

database

A logical or a character string. Should events be logged into a database? Default is FALSE. If TRUE or "mongoDB" the connection URL to the database will be read from the first line of a text file named ".db_url".

...

a set of named objects (usually of type character, numeric, or date) to be logged as parameters common to all events.

Details

set_logging assigns to the parent frame a new environment log_settings_global for storing global event parameters. If database = TRUE additional database connection object named log_db is assigned to the parent frame as well.

See Also

Other setting up logging parameters functions: log_params, set_logging_session

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
if (interactive()) {

  set_logging(r_console = TRUE,
              js_console = FALSE,
              "param_1" = 1,
              "param_2" = "A")

  shiny::shinyApp(
    ui = shiny::fluidPage(),
    server = function(input, output) {
      set_logging_session()
      log_event("Event with global params")
    }
  )
}

shinyEventLogger documentation built on May 1, 2019, 9:26 p.m.