shinyprintf: Shiny "printf" style tracing for debugging purposes

Description Usage Arguments Details References Examples

View source: R/shiny.R

Description

Put it inside the shiny::observe in case of reactive values are run. Timestamp displaying date and time is prepended to log messages. Other than debugging purposes, it can also be used as a logger when re-directed to a file. However, the performance is not tested.

Usage

1
shinyprintf(x, text = NULL, con = "stdout")

Arguments

x

variable (static or reactive). See Details.

text

character. (optional) description added to the variable name. if empty, the default value is NULL therefore only the variable name will be used.

con

character. Pipe connection. The options are stdout, stderr or an absolute or a relative path. Default is stdout.

Details

Recommended to add the following snippet as shinyprinf: observe(mmy::shinyprintf(${1:var}, text = NULL)).

See Shiny's Reactivity to understand what a "reactive variable" is.

References

https://shiny.rstudio.com/articles/debugging.html

Examples

1
2
3
4
5
6
7
## Not run: 
x <- 1L
shinyprintf(x, "test")
## Persistent logging to a file:
shinyprintf("test", con = file.path(getwd(), "file.log"))

## End(Not run)

strboul/mmy documentation built on Sept. 24, 2021, 12:08 p.m.