-
-
Notifications
You must be signed in to change notification settings - Fork 96
Sync version 5.0.0-dev with master branch #400
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
Conversation
New simplified TalkerKeys API (String Log key)
Reviewer's GuideThis PR merges the v5.0.0-dev branch into master, replacing the old enum-based API with a new string-based key system, overhauling filter logic to use enabled/disabled keys, extending settings to register custom keys, updating all UI and logger integrations to adopt these changes, and bumping versions and changelogs across all packages. Class diagram for TalkerKey and log key migrationclassDiagram
class TalkerKey {
<<abstract>>
+static const error
+static const critical
+static const info
+static const debug
+static const verbose
+static const warning
+static const exception
+static const httpError
+static const httpRequest
+static const httpResponse
+static const blocEvent
+static const blocTransition
+static const blocClose
+static const blocCreate
+static const riverpodAdd
+static const riverpodUpdate
+static const riverpodDispose
+static const riverpodFail
+static const route
+static String fromLogLevel(LogLevel)
}
class LogLevel {
<<enum>>
error
critical
info
debug
verbose
warning
}
TalkerKey ..> LogLevel : fromLogLevel
Class diagram for TalkerFilter and filtering logic changesclassDiagram
class TalkerFilter {
+List<String> enabledKeys
+List<String> disabledKeys
+String? searchQuery
+bool filter(TalkerData)
+TalkerFilter copyWith(...)
}
class TalkerData {
+String? key
+String? title
+String generateTextMessage()
}
TalkerFilter --> TalkerData : filter
Class diagram for Talker and filter integrationclassDiagram
class Talker {
+TalkerSettings settings
+TalkerFilter filter
+void configure(...)
+List<TalkerData> history
}
Talker --> TalkerSettings
Talker --> TalkerFilter
Talker --> TalkerData : history
Class diagram for TalkerViewController and UI filter changesclassDiagram
class TalkerViewController {
+TalkerFilter filter
+void updateFilterSearchQuery(String)
+void addFilterKey(String)
+void removeFilterKey(String)
}
TalkerViewController --> TalkerFilter
Class diagram for logger packages registering keysclassDiagram
class TalkerDioLogger {
+TalkerDioLoggerSettings settings
+void registerKeys(List<String>)
}
class TalkerBlocObserver {
+TalkerBlocLoggerSettings settings
+void registerKeys(List<String>)
}
class TalkerRiverpodObserver {
+TalkerRiverpodLoggerSettings settings
+void registerKeys(List<String>)
}
TalkerDioLogger --> TalkerKey
TalkerBlocObserver --> TalkerKey
TalkerRiverpodObserver --> TalkerKey
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 @Frezyx - I've reviewed your changes - here's some feedback:
- Add unit tests for
disabledKeys
inTalkerFilter
(e.g. confirm items are excluded whendisabledKeys
is non‐empty) since current tests only coverenabledKeys
behavior. - Consider extracting the repeated
settings.registerKeys([...])
calls into a shared helper or auto-registering coreTalkerKey
values inTalkerSettings
to reduce duplication across interceptors/observers. - Document or validate the precedence when a key appears in both
enabledKeys
anddisabledKeys
to avoid ambiguous filter configurations and make the behavior explicit.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add unit tests for `disabledKeys` in `TalkerFilter` (e.g. confirm items are excluded when `disabledKeys` is non‐empty) since current tests only cover `enabledKeys` behavior.
- Consider extracting the repeated `settings.registerKeys([...])` calls into a shared helper or auto-registering core `TalkerKey` values in `TalkerSettings` to reduce duplication across interceptors/observers.
- Document or validate the precedence when a key appears in both `enabledKeys` and `disabledKeys` to avoid ambiguous filter configurations and make the behavior explicit.
## Individual Comments
### Comment 1
<location> `packages/talker/lib/src/settings.dart:171` </location>
<code_context>
/// By using the `colors` field, you can customize the text colors for specific log keys in the console.
final Map<String, AnsiPen> colors = _defaultColors;
- String getTitleByLogKey(String key) {
- return titles[key] ?? key;
+ /// A list of [TalkerKey]s that can be included in filter by [TalkerScreen] settings
+ /// This allows you to register custom keys that can be used for filtering logs in the Talker UI.
</code_context>
<issue_to_address>
The method getTitleByLogKey was replaced by getTitleByKey, but the old method is still present in some comments.
Please update all doc comments and code examples to reference getTitleByKey instead of getTitleByLogKey.
</issue_to_address>
### Comment 2
<location> `packages/talker_flutter/lib/src/ui/widgets/data_card.dart:183` </location>
<code_context>
String? get _message {
final isHttpLog = [
- TalkerLogType.httpError.key,
- TalkerLogType.httpRequest.key,
- TalkerLogType.httpResponse.key,
+ TalkerKey.httpError,
+ TalkerKey.httpRequest,
</code_context>
<issue_to_address>
The check for isHttpLog uses widget.data.title instead of widget.data.key.
Using title instead of key may cause incorrect HTTP log detection if titles are customized. Please update the check to use widget.data.key for consistency and accuracy.
</issue_to_address>
### Comment 3
<location> `packages/talker_flutter/lib/src/ui/widgets/talker_view_appbar.dart:97` </location>
<code_context>
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
+ final uniqKeys = widget.uniqKeys..removeWhere((e) => e == null);
return SliverAppBar(
backgroundColor: widget.talkerTheme.backgroundColor,
</code_context>
<issue_to_address>
uniqKeys is modified in place, which may affect the parent widget's state.
This in-place mutation could cause side effects if widget.uniqKeys is accessed elsewhere. Create a new list to prevent unintended mutations.
</issue_to_address>
### Comment 4
<location> `packages/talker_flutter/lib/src/ui/widgets/talker_view_appbar.dart:65` </location>
<code_context>
+ final indexes = widget.talker.filter.enabledKeys
+ .map((e) => widget.keys.indexOf(e))
+ .toList();
+ _bcontroller.selectIndexes(indexes);
super.initState();
}
</code_context>
<issue_to_address>
Indexes passed to selectIndexes may include -1 if a key is not found.
Filter out -1 values from indexes before passing them to selectIndexes to avoid potential issues.
</issue_to_address>
### Comment 5
<location> `packages/talker_flutter/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 6
<location> `packages/talker_flutter/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
### Comment 7
<location> `packages/talker/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 8
<location> `packages/talker/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
### Comment 9
<location> `packages/talker_bloc_logger/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 10
<location> `packages/talker_bloc_logger/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
### Comment 11
<location> `packages/talker_dio_logger/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 12
<location> `packages/talker_dio_logger/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
### Comment 13
<location> `packages/talker_http_logger/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase mentioned, 'filed' should be 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 14
<location> `packages/talker_logger/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 15
<location> `packages/talker_logger/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
### Comment 16
<location> `packages/talker_riverpod_logger/CHANGELOG.md:34` </location>
<code_context>
+Thanks to [Frezyx](https://github.com/Frezyx)
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
</code_context>
<issue_to_address>
Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
=======
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field
>>>>>>> REPLACE
</suggested_fix>
### Comment 17
<location> `packages/talker_riverpod_logger/CHANGELOG.md:35` </location>
<code_context>
+
+# 5.0.0-dev.3
+- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed
+- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
+
+Thanks to [Frezyx](https://github.com/Frezyx)
</code_context>
<issue_to_address>
Typo: 'Deperecate' should be 'Deprecate'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter**
=======
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter**
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
String getTitleByLogKey(String key) { | ||
return titles[key] ?? key; |
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.
nitpick: The method getTitleByLogKey was replaced by getTitleByKey, but the old method is still present in some comments.
Please update all doc comments and code examples to reference getTitleByKey instead of getTitleByLogKey.
String? get _message { | ||
final isHttpLog = [ | ||
TalkerLogType.httpError.key, | ||
TalkerLogType.httpRequest.key, | ||
TalkerLogType.httpResponse.key, |
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.
issue (bug_risk): The check for isHttpLog uses widget.data.title instead of widget.data.key.
Using title instead of key may cause incorrect HTTP log detection if titles are customized. Please update the check to use widget.data.key for consistency and accuracy.
@@ -91,6 +94,7 @@ class _TalkerViewAppBarState extends State<TalkerViewAppBar> | |||
@override | |||
Widget build(BuildContext context) { | |||
final theme = Theme.of(context); | |||
final uniqKeys = widget.uniqKeys..removeWhere((e) => e == null); |
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.
issue (bug_risk): uniqKeys is modified in place, which may affect the parent widget's state.
This in-place mutation could cause side effects if widget.uniqKeys is accessed elsewhere. Create a new list to prevent unintended mutations.
final indexes = widget.talker.filter.enabledKeys | ||
.map((e) => widget.keys.indexOf(e)) | ||
.toList(); | ||
_bcontroller.selectIndexes(indexes); |
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.
issue (bug_risk): Indexes passed to selectIndexes may include -1 if a key is not found.
Filter out -1 values from indexes before passing them to selectIndexes to avoid potential issues.
packages/talker_flutter/CHANGELOG.md
Outdated
Thanks to [Frezyx](https://github.com/Frezyx) | ||
|
||
# 5.0.0-dev.3 | ||
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed |
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.
issue (typo): Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed | |
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field |
Thanks to [Frezyx](https://github.com/Frezyx) | ||
|
||
# 5.0.0-dev.3 | ||
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed |
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.
issue (typo): Typo: 'filed' should be 'field'.
In the phrase mentioned, 'filed' should be 'field'.
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed | |
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field |
Thanks to [Frezyx](https://github.com/Frezyx) | ||
|
||
# 5.0.0-dev.3 | ||
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed |
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.
issue (typo): Typo: 'filed' should be 'field'.
In the phrase, change 'filed' to 'field'.
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed | |
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** field |
|
||
# 5.0.0-dev.3 | ||
- [talker] Upgrade **BaseTalkerFilter** class - add new filtering way by **List<String> keys** filed | ||
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter** |
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.
issue (typo): Typo: 'Deperecate' should be 'Deprecate'.
- [talker] Deperecate **titles** and **types** fields from **BaseTalkerFilter** | |
- [talker] Deprecate **titles** and **types** fields from **BaseTalkerFilter** |
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Summary by Sourcery
Synchronize the 5.0.0-dev branch with master by migrating to the new string-based TalkerKey API, replacing deprecated title/type filtering with enabledKeys/disabledKeys, and updating all packages, UIs, tests, and documentation accordingly.
New Features:
Enhancements:
Documentation:
Tests: