Plumber Logging

plumber
Note

See Plumber Logging on R Views for a discussion of this code.

This asset shows how to log information about plumber API requests and responses by using preroute and postroute hooks. This allows information about the request and the response to be included in the log entry. The logger package is used to generate the log files.

gif showing log files being written in a terminal environment.

Once these log files have been generated, a Shiny application can be used to monitor API metrics in real time. This Shiny application can even be published to Connect to monitor centralized API logs:

gif of Shiny app monitoring API metrics

Code used for this example is available in this GitHub repository.

Back to top