You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: global command observer (a BlocObserver for command_it) #22
One of the best things about Bloc is BlocObserver. With a single class you get a complete live log of your app: which event came in, which state followed, and which errors happened. For debugging and for production logging it is hard to beat.
command_it has the same building blocks:
a command run is the equivalent of a Bloc event (name + parameter),
the CommandResult is the equivalent of a Bloc state (running, data, error).
The only missing piece is a single global place where all of this comes together. Today Command.loggingHandler is called once per run, on completion, so the "running" state and the moment a command was started never show up in it.
Imagine one global observer that prints a timeline like this for the whole app:
That would make command_it much easier to debug and monitor, and would be a real argument for people who are choosing between command_it and Bloc. I think it could become one of the package's killer features.
Ideally the observer would report:
when a command is started (name and parameter),
its result (data or error),
optionally when a command is created and disposed.
A first small step could be an opt-in way to also call loggingHandler when an async command starts, without changing the current default behavior.
Activity