Hey all, I’ve added a logging middleware that log...
# redux
b
Hey all, I’ve added a logging middleware that logs the action and the next state to the end of my middleware chain. This logs the action right before it makes it to the reducer however because middlewares can modify an action I can’t guarantee that the action being logged was the original action that was dispatched.  My initial thoughts were to add a log middleware to the beginning of the middleware chain in addition to the end of the chain but I’m concerned about spamming logs since we dispatch so many actions.  Does anyone have any thoughts or feedback on this?
b
Managed middleware (on both ends of the chain) that's able to check if last action is the same as first?
p
Certainly possibly and entirely up to your needs. Def will add noise to logs, but if tags and filters are used you can get around that. You could do both logging in the same Middleware, just before and after dispatch
b
Thanks guys!
@Patrick Jackson Can you elaborate on doing both in the same middleware please?
p
Sure. Just add logging before and after the call to 'next(action)' and add the loggingmiddleware as the first in the chain
👍 1