talker_bloc_logger

Lightweight and customizable BLoC 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 BLoC's event callign and state emits 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_bloc_logger: ^4.5.1

Usage

Just set TalkerBlocObserver as Bloc.observer field and it will work

import 'package:talker_bloc_logger/talker_bloc_logger.dart';


Bloc.observer = TalkerBlocObserver();

Using with Talker

You can add your talker instance for TalkerBlocObserver if your app already uses Talker.

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

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

final talker = Talker();
Bloc.observer = TalkerBlocObserver(talker: talker);

Settings

This package has a lot of customization options You can enable/disable somethings events, Bloc creation, changes, closing logs, etc...

Bloc.observer = TalkerBlocObserver(
    settings: TalkerBlocLoggerSettings(
      enabled: true,
      printEventFullData: false,
      printStateFullData: false,
      printChanges: true,
      printClosings: true,
      printCreations: true,
      printEvents: true,
      printTransitions: true,
      // If you want log only AuthBloc transitions
      transitionFilter: (bloc, transition) =>
          bloc.runtimeType.toString() == 'AuthBloc',
      // If you want log only AuthBloc events
      eventFilter: (bloc, event) => bloc.runtimeType.toString() == 'AuthBloc',
    ),
  );

Additional information

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