talker_riverpod_logger

Lightweight and customizable Riverpod state management library logger on talker base.
Talker - Advanced exception handling and logging for dart/flutter applications 🚀

GitHub codecov Pub License: MIT
talker talker_flutter talker_logger

Preview

This is how the logs of your Riverpod's state will look in the console

For better understanding how it works check Web Demo page

Getting started

Follow these steps to use this package

Add dependency

dependencies:
  talker_riverpod_logger: ^4.5.1

Usage

Just pass TalkerRiverpodObserver to either ProviderScope or ProviderContainer and it will work

import 'package:talker_riverpod_observer/talker_riverpod_observer.dart';

runApp(
  ProviderScope(
    observers: [
      TalkerRiverpodObserver(),
    ],
    child: MyApp(),
  )
);

or

import 'package:talker_riverpod_observer/talker_riverpod_observer.dart';

final container = ProviderContainer(
  observers: [
    TalkerRiverpodObserver(),
  ],
);

Using with Talker

You can add your talker instance for TalkerRiverpodLogger if your Appication already uses Talker.

In this case, all logs and errors will fall into your unified tracking system

import 'package:talker_riverpod_observer/talker_riverpod_observer.dart';
import 'package:talker/talker.dart';

final talker = Talker();

runApp(
  ProviderScope(
    observers: [
      TalkerRiverpodObserver(
        talker: talker,
      ),
    ],
    child: MyApp(),
  )
);

or

import 'package:talker_riverpod_observer/talker_riverpod_observer.dart';
import 'package:talker/talker.dart';

final talker = Talker();

final container = ProviderContainer(
  observers: [
    TalkerRiverpodObserver(
      talker: talker,
    ),
  ],
);

Settings

This package has a lot of customization options You can enable/disable somethings events, Provider add, update, dispose, fail logs, etc...

TalkerRiverpodObserver(
  settings: TalkerRiverpodLoggerSettings(
    enabled: true,
    printStateFullData: false,
    printProviderAdded: true,
    printProviderUpdated: true,
    printProviderDisposed: true,
    printProviderFailed: true,
    // If you want log only AuthProvider events
    eventFilter: (provider) => provider.runtimeType == 'AuthProvider<User>',
  ),
)

Additional information

The project is under development and ready for your pull-requests and issues 👍
Thank you for support ❤️