15.4 Logging reactivity with {whereami}
15.4.1 What is logging? - What is a reactive logging?
Logging is a way to access the log file of the app. It is used to debug the app’s code, and it is a useful feature when debugging someone else’s code. The log file is where all the steps taken by the app are registered, it tells you what your app is doing. So that, being able to access the log file and locate the part that is to be debugged is an important task. To facilitate the location of the “part of the shiny code that is to be debugged” a warning is positioned for simplification of the procedure.
There are several packages in R that provide useful functions for logging, here we talk about some specific packages to use within a shiny app.
….whereami is one of them.
{whereami} return where the script is run from

Figure 15.4: {whereami} package
whereami::whereami()
(Sidi and Müller 2019 - github )
For example, whereami()
function let’s you locate the name of the file you are working on:
library(whereami)
::whereami() whereami
## ── Running From: ./bookclub-epgs.Rmd ───────────────────────────────────────────
Then, as classical procedure, with the use of the base::cat()
function within the logging procedure, the cat_where()
function in {whereami} package, helps you to producing an output in a user-defined function. It converts arguments to character vectors and, concatenates them to a single character vector, in the locate file.
Where should it be located?
If it is added to the app_server()
, it will print the location of the function call to the logs.
The combination with cat_where()
will implement a reactive logging to the console while developing or debugging an app.
::cat_where( whereami::whereami() ) whereami
cat_where(where,
type = c("rule", "boxx", "bullet", "line", "print"),
color = "some_colors",
...)
Another feature is to get a list of all the counters: the numbers of time each of the located cat functions have been called and plot the statistics of the usage.
::counter_get()
whereamiplot(whereami::counter_get())

Figure 15.5: {whereami} package
As an example:
library(whereami)
require(ggplot2)
ggplot(iris) +
aes(x=Sepal.Length,y=Sepal.Width) +
geom_point() +
labs(caption = sprintf('sourced from: %s',whereami()))
In this context, it is everything we need to know about logging with whereami.
More information about in general logging a shiny app can be found here: blog.sellorm.com