talker_cherrypick_logger 3.0.1 copy "talker_cherrypick_logger: ^3.0.1" to clipboard
talker_cherrypick_logger: ^3.0.1 copied to clipboard

A Talker logger integration for CherryPick DI to observe and log DI events and errors.

Melos + FVM CI Netlify Status


talker_cherrypick_logger #

An integration package that allows you to log CherryPick Dependency Injection (DI) container events using the Talker logging system.
All CherryPick lifecycle events, instance creations, cache operations, module activities, cycles, and errors are routed directly to your Talker logger for easy debugging and advanced diagnostics.


Features #

  • Automatic DI container logging:
    All core CherryPick events (instance creation/disposal, cache hits/misses, module install/removal, scopes, cycles, errors) are logged through Talker.
  • Flexible log levels:
    Each event uses the appropriate Talker log level (info, warning, verbose, handle for errors).
  • Works with any Talker setup:
    No extra dependencies required except Talker and CherryPick.
  • Improves debugging and DI transparency in both development and production.

Getting started #

1. Add dependencies #

Install the package from pub.dev:

In your pubspec.yaml:

dependencies:
  cherrypick: ^latest
  talker: ^latest
  talker_cherrypick_logger: ^latest

2. Import the package #

import 'package:talker/talker.dart';
import 'package:cherrypick/cherrypick.dart';
import 'package:talker_cherrypick_logger/talker_cherrypick_logger.dart';

Usage #

Basic integration #

  1. Create a Talker instance (optionally customize Talker as you wish):

    final talker = Talker();
    
  2. Create the observer and pass it to CherryPick:

    final observer = TalkerCherryPickObserver(talker);
    
    // On DI setup, pass observer when opening (or re-opening) root or any custom scope
    CherryPick.openRootScope(observer: observer);
    
  3. Now all DI events appear in your Talker logs!

Example log output

  • [binding][CherryPick] MyService — MyServiceImpl (scope: root)
  • [create][CherryPick] MyService — MyServiceImpl => Instance(...) (scope: root)
  • [cache hit][CherryPick] MyService — MyServiceImpl (scope: root)
  • [cycle][CherryPick] Detected: A -> B -> C -> A (scope: root)
  • [error][CherryPick] Failed to resolve dependency
  • [diagnostic][CherryPick] Cache cleared

How it works

TalkerCherryPickObserver implements CherryPickObserver and routes all methods/events to Talker:

  • Regular events: .info()
  • DI Warnings and cycles: .warning()
  • Diagnostics: .verbose()
  • Errors: .handle() (so they are visible in Talker error console, with stack trace)

Extended example #

import 'package:cherrypick/cherrypick.dart';
import 'package:talker/talker.dart';
import 'package:talker_cherrypick_logger/talker_cherrypick_logger.dart';

void main() {
  final talker = Talker();
  final observer = TalkerCherryPickObserver(talker);

  // Optionally: customize Talker output or filtering
  // talker.settings.logLevel = TalkerLogLevel.debug;

  CherryPick.openRootScope(observer: observer);

  // ...setup your DI modules as usual
  // All container events will appear in Talker logs for easy debugging!
}

Additional information #

  • This package is especially useful for debugging large or layered projects using CherryPick.
  • For advanced Talker configurations (UI, outputs to remote, filtering), see the Talker documentation.
  • This package does not interfere with DI graph construction or your app's behavior — it's purely diagnostic.
  • For questions or issues, open an issue on the main cherrypick repository.

Contributing #

Feel free to contribute improvements or report bugs via pull requests or issues!


License #

See LICENSE for details.

0
likes
160
points
425
downloads

Publisher

unverified uploader

Weekly Downloads

A Talker logger integration for CherryPick DI to observe and log DI events and errors.

Homepage
Repository (GitHub)
View/report issues

Topics

#cherrypick #state #logging

Documentation

Documentation
API reference

License

Apache-2.0 (license)

Dependencies

cherrypick, talker

More

Packages that depend on talker_cherrypick_logger