| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/graph.R |
| 3 |
\name{reactlog} |
| 4 |
\alias{reactlog} |
| 5 |
\alias{reactlogShow} |
| 6 |
\alias{reactlogReset} |
| 7 |
\alias{reactlogAddMark} |
| 8 |
\title{Reactive Log Visualizer} |
| 9 |
\usage{ |
| 10 |
reactlog() |
| 11 |
|
| 12 |
reactlogShow(time = TRUE) |
| 13 |
|
| 14 |
reactlogReset() |
| 15 |
|
| 16 |
reactlogAddMark(session = getDefaultReactiveDomain()) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{time}{A boolean that specifies whether or not to display the |
| 20 |
time that each reactive takes to calculate a result.} |
| 21 |
|
| 22 |
\item{session}{The Shiny session to assign the mark to. Defaults to the |
| 23 |
current session.} |
| 24 |
} |
| 25 |
\description{ |
| 26 |
Provides an interactive browser-based tool for visualizing reactive |
| 27 |
dependencies and execution in your application. |
| 28 |
} |
| 29 |
\details{ |
| 30 |
To use the reactive log visualizer, start with a fresh R session and |
| 31 |
run the command \code{reactlog::reactlog_enable()}; then launch your |
| 32 |
application in the usual way (e.g. using \code{\link[=runApp]{runApp()}}). At |
| 33 |
any time you can hit Ctrl+F3 (or for Mac users, Command+F3) in your |
| 34 |
web browser to launch the reactive log visualization. |
| 35 |
|
| 36 |
The reactive log visualization only includes reactive activity up |
| 37 |
until the time the report was loaded. If you want to see more recent |
| 38 |
activity, refresh the browser. |
| 39 |
|
| 40 |
Note that Shiny does not distinguish between reactive dependencies |
| 41 |
that "belong" to one Shiny user session versus another, so the |
| 42 |
visualization will include all reactive activity that has taken place |
| 43 |
in the process, not just for a particular application or session. |
| 44 |
|
| 45 |
As an alternative to pressing Ctrl/Command+F3--for example, if you |
| 46 |
are using reactives outside of the context of a Shiny |
| 47 |
application--you can run the \code{reactlogShow} function, which will |
| 48 |
generate the reactive log visualization as a static HTML file and |
| 49 |
launch it in your default browser. In this case, refreshing your |
| 50 |
browser will not load new activity into the report; you will need to |
| 51 |
call \code{reactlogShow()} explicitly. |
| 52 |
|
| 53 |
For security and performance reasons, do not enable |
| 54 |
\code{options(shiny.reactlog=TRUE)} (or \code{reactlog::reactlog_enable()}) in |
| 55 |
production environments. When the option is enabled, it's possible |
| 56 |
for any user of your app to see at least some of the source code of |
| 57 |
your reactive expressions and observers. In addition, reactlog |
| 58 |
should be considered a memory leak as it will constantly grow and |
| 59 |
will never reset until the R session is restarted. |
| 60 |
} |
| 61 |
\section{Functions}{ |
| 62 |
\itemize{ |
| 63 |
\item \code{reactlog()}: Return a list of reactive information. Can be used in |
| 64 |
conjunction with \link[reactlog:reactlog_show]{reactlog::reactlog_show} to later display the reactlog |
| 65 |
graph. |
| 66 |
|
| 67 |
\item \code{reactlogShow()}: Display a full reactlog graph for all sessions. |
| 68 |
|
| 69 |
\item \code{reactlogReset()}: Resets the entire reactlog stack. Useful for debugging |
| 70 |
and removing all prior reactive history. |
| 71 |
|
| 72 |
\item \code{reactlogAddMark()}: Adds "mark" entry into the reactlog stack. This is |
| 73 |
useful for programmatically adding a marked entry in the reactlog, rather |
| 74 |
than using your keyboard's key combination. |
| 75 |
|
| 76 |
For example, we can \emph{mark} the reactlog at the beginning of an |
| 77 |
\code{observeEvent}'s calculation: |
| 78 |
|
| 79 |
\if{html}{\out{<div class="sourceCode r">}}\preformatted{observeEvent(input$my_event_trigger, \{ |
| 80 |
# Add a mark in the reactlog |
| 81 |
reactlogAddMark() |
| 82 |
# Run your regular event reaction code here... |
| 83 |
.... |
| 84 |
\}) |
| 85 |
}\if{html}{\out{</div>}} |
| 86 |
|
| 87 |
}} |