Log-Driven Development solves all of these problems. The idea is that by driving the business logic of an app via logs, we are able to automatically capture information that helps us reproduce bugs, resolve user issues, and understand user behavior without additional work.
Using Redux makes this very easy: we can just log everything and then search and investigate our logs later.
Here are a few examples of how we use Log-Driven Development at LogRocket:
Scenario 1: Reproducing Bugs
We use crash reporting tools and we get a bunch of errors that look something like this:
We don’t have enough information here to reproduce the bug. However, since we are using Redux in our app, we capture the series of events that led to the problem in LogRocket:
Scenario 2: Resolving User Issues
The other day, a user told us that they were having difficulty logging in. Normally I’d have to ask a bunch of clarifying questions: “What account are you using?”, “Can you send us a screenshot?”, “Have you tried incognito mode?” In this case, we had captured all of the information in logs, and we discovered the fix without back-and-forth. Success!
Scenario 3: Understanding User Behavior
Our product manager works really hard to understand what makes our users successful. He set up Heap to be able to retroactively analyze interactions, but we found that there were still a number of events that he had to ask us to manually tag in the app. I set up a Redux middleware to send all of our events to Segment: https://github.com/rangle/redux-segment and we haven’t had a problem since 🙂
Getting Started With Log-Driven Development
- Use Redux
- Use Redux libraries for your app’s business logic:
redux-query for REST APIs
apollo-client for GraphQL APIs
redux-saga for asynchronous events
- Use LogRocket to capture log data in production
LogRocket: Full visibility into your web and mobile apps
LogRocket is a frontend application monitoring solution that lets you replay problems as if they happened in your own browser. Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay the session to quickly understand what went wrong. It works perfectly with any app, regardless of framework, and has plugins to log additional context from Redux, Vuex, and @ngrx/store.