-
-
Couldn't load subscription status.
- Fork 101
fix: respect custom TalkerLogger output in TalkerFlutter.init
#367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: respect custom TalkerLogger output in TalkerFlutter.init
#367
Conversation
Reviewer's GuideThe Sequence Diagram: Logger Initialization with Custom Logger (Before PR)sequenceDiagram
actor Developer
participant TF_init as TalkerFlutter.init
participant customLogger as Custom TalkerLogger
participant CL_copyWith as customLogger.copyWith
participant Talker_ctor as Talker Constructor
Developer->>+TF_init: init(logger: customLogger)
Note over TF_init: customLogger has its own output function
TF_init->>customLogger: Access customLogger
TF_init->>+CL_copyWith: customLogger.copyWith(output: _defaultFlutterOutput)
Note right of CL_copyWith: Overrides custom output with _defaultFlutterOutput
CL_copyWith-->>-TF_init: loggerWithOverriddenOutput
TF_init->>+Talker_ctor: Talker(logger: loggerWithOverriddenOutput, ...)
Talker_ctor-->>-TF_init: talkerInstance
TF_init-->>-Developer: talkerInstance
Note over Developer: Custom logger's output was NOT used.
Sequence Diagram: Logger Initialization with Custom Logger (After PR)sequenceDiagram
actor Developer
participant TF_init as TalkerFlutter.init
participant customLogger as Custom TalkerLogger
participant Talker_ctor as Talker Constructor
Developer->>+TF_init: init(logger: customLogger)
Note over TF_init: customLogger has its own output function
TF_init->>+Talker_ctor: Talker(logger: customLogger, ...)
Note right of Talker_ctor: customLogger (with its original output) is used directly
Talker_ctor-->>-TF_init: talkerInstance
TF_init-->>-Developer: talkerInstance
Note over Developer: Custom logger's output IS respected.
Sequence Diagram: Logger Initialization with Default Logger (After PR)sequenceDiagram
actor Developer
participant TF_init as TalkerFlutter.init
participant New_TL as new TalkerLogger
participant Talker_ctor as Talker Constructor
Developer->>+TF_init: init(logger: null) / init()
Note over TF_init: No custom logger provided
TF_init->>+New_TL: TalkerLogger(output: _defaultFlutterOutput)
New_TL-->>-TF_init: defaultLogger
TF_init->>+Talker_ctor: Talker(logger: defaultLogger, ...)
Talker_ctor-->>-TF_init: talkerInstance
TF_init-->>-Developer: talkerInstance
Note over Developer: Default Flutter-specific logger is used.
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
TalkerLogger output in TalkerFlutter.init
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @techouse - I've reviewed your changes - here's some feedback:
- The changes to
pubspec_overrides.yamlappear to be local development overrides; please confirm if they are intended for this PR.
Here's what I looked at during the review
- π’ General issues: all looks good
- π’ Security: all looks good
- π’ Testing: all looks good
- π’ Complexity: all looks good
- π’ Documentation: all looks good
Help me be more useful! Please click π or π on each comment and I'll use the feedback to improve your reviews.
TalkerLogger output in TalkerFlutter.initTalkerLogger output in TalkerFlutter.init
TalkerLogger output in TalkerFlutter.initTalkerLogger output in TalkerFlutter.init
This change fixes the issue #365 where passing a custom
TalkerLoggerintoTalkerFlutter.initwould still have its output callback unconditionally overridden by the default Flutter output function. Now, if you supply your ownTalkerLogger, its output delegate is used verbatim; the default only applies when you donβt pass any logger at all.Before
After
Talker.init(logger: customLogger)-> uses customLogger.output unchanged.TalkerLogger(output: _defaultFlutterOutput) for platform-aware printing.Benefits:
tl;dr fixes #365
Summary by Sourcery
Fix the handling of custom TalkerLogger output in TalkerFlutter initialization to respect user-provided logging configurations
New Features:
Bug Fixes:
Enhancements: