enableLoggingObserver function

void Function() enableLoggingObserver()

Enables a simple logging observer for debugging purposes.

This registers a JObserverDelegate on JObserver to log:

  • When a JIntent is dispatched, fails, is cancelled or is dropped.
  • When the state changes (from → to), including the triggering intent (if provided).
  • When a JEffect is emitted by a controller.

It coexists with other observers and static callbacks, and calling it again has no additional effect. It does nothing outside kDebugMode. The returned function unregisters the observer.

Example:

void main() {
  enableLoggingObserver();
  runApp(MyApp());
}

Implementation

void Function() enableLoggingObserver() {
  if (!kDebugMode) return () {};
  return JObserver.addObserver(_loggingObserver);
}