Missing error and exception in console logs#388
Closed
Zekfad wants to merge 5 commits intoFrezyx:masterfrom
Closed
Missing error and exception in console logs#388Zekfad wants to merge 5 commits intoFrezyx:masterfrom
Zekfad wants to merge 5 commits intoFrezyx:masterfrom
Conversation
…tters this will remove late initialization checks from runtime and unnecessary getter overloads, which will also make classes more friendly to extension
Contributor
Reviewer's GuideRefactors initialization to use constructor initializers instead of late initialization, streamlines constructors for exception and error models, and ensures error/exception details are included in generated console messages. Sequence Diagram for Updated TalkerData Message GenerationsequenceDiagram
title Sequence Diagram: Updated TalkerData.generateTextMessage
participant C as Caller
participant TD as "TalkerData"
C->>TD: generateTextMessage(timeFormat)
activate TD
TD->>TD: displayTitleWithTime(timeFormat)
TD->>TD: get displayMessage
TD->>TD: get displayException
TD->>TD: get displayError
TD->>TD: get displayStackTrace
TD-->>C: Constructed Log String
deactivate TD
Sequence Diagram for Updated TalkerLog Message GenerationsequenceDiagram
title Sequence Diagram: Updated TalkerLog.generateTextMessage
participant C as Caller
participant TL as "TalkerLog"
C->>TL: generateTextMessage(timeFormat)
activate TL
TL->>TL: displayTitleWithTime(timeFormat)
TL->>TL: get displayMessage
TL->>TL: get displayException
TL->>TL: get displayError
TL->>TL: get displayStackTrace
TL-->>C: Constructed Log String
deactivate TL
Updated Class Diagram for Talker ModelsclassDiagram
class TalkerData {
+String? message
+LogLevel? logLevel
+Exception? exception
+Error? error
+StackTrace? stackTrace
+String? title
+final DateTime time
+AnsiPen? pen
+String? key
+generateTextMessage(TimeFormat timeFormat) String
}
class TalkerException {
+TalkerException(Exception exception, String? message, StackTrace? stackTrace, String? key, String? title, LogLevel? logLevel)
}
class TalkerError {
+TalkerError(Error error, String? message, StackTrace? stackTrace, String? key, String? title, LogLevel? logLevel)
}
class TalkerLog {
+TalkerLog(String message, LogLevel? logLevel, String? key, String? title, AnsiPen? pen, Exception? exception, Error? error, StackTrace? stackTrace)
+generateTextMessage(TimeFormat timeFormat) String
}
TalkerData <|-- TalkerException
TalkerData <|-- TalkerError
TalkerData <|-- TalkerLog
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey @Zekfad - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `packages/talker/lib/src/models/talker_data.dart:71` </location>
<code_context>
String generateTextMessage(
{TimeFormat timeFormat = TimeFormat.timeAndSeconds}) {
- return '${displayTitleWithTime(timeFormat: timeFormat)}$message$displayStackTrace';
+ return '${displayTitleWithTime(timeFormat: timeFormat)}$displayMessage$displayException$displayError$displayStackTrace';
}
}
</code_context>
<issue_to_address>
Missing delimiters between concatenated display segments
Check that each getter adds necessary spacing or newlines, or add explicit delimiters here to prevent segments from merging.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
String generateTextMessage(
{TimeFormat timeFormat = TimeFormat.timeAndSeconds}) {
- return '${displayTitleWithTime(timeFormat: timeFormat)}$displayMessage$displayException$displayError$displayStackTrace';
=======
String generateTextMessage(
{TimeFormat timeFormat = TimeFormat.timeAndSeconds}) {
return '${displayTitleWithTime(timeFormat: timeFormat)}\n'
'${displayMessage ?? ''}${displayMessage != null ? '\n' : ''}'
'${displayException ?? ''}${displayException != null ? '\n' : ''}'
'${displayError ?? ''}${displayError != null ? '\n' : ''}'
'${displayStackTrace ?? ''}';
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
69
to
+71
| String generateTextMessage( | ||
| {TimeFormat timeFormat = TimeFormat.timeAndSeconds}) { | ||
| return '${displayTitleWithTime(timeFormat: timeFormat)}$message$displayStackTrace'; | ||
| return '${displayTitleWithTime(timeFormat: timeFormat)}$displayMessage$displayException$displayError$displayStackTrace'; |
Contributor
There was a problem hiding this comment.
suggestion: Missing delimiters between concatenated display segments
Check that each getter adds necessary spacing or newlines, or add explicit delimiters here to prevent segments from merging.
Suggested change
| String generateTextMessage( | |
| {TimeFormat timeFormat = TimeFormat.timeAndSeconds}) { | |
| return '${displayTitleWithTime(timeFormat: timeFormat)}$message$displayStackTrace'; | |
| return '${displayTitleWithTime(timeFormat: timeFormat)}$displayMessage$displayException$displayError$displayStackTrace'; | |
| String generateTextMessage( | |
| {TimeFormat timeFormat = TimeFormat.timeAndSeconds}) { | |
| return '${displayTitleWithTime(timeFormat: timeFormat)}\n' | |
| '${displayMessage ?? ''}${displayMessage != null ? '\n' : ''}' | |
| '${displayException ?? ''}${displayException != null ? '\n' : ''}' | |
| '${displayError ?? ''}${displayError != null ? '\n' : ''}' | |
| '${displayStackTrace ?? ''}'; |
Owner
|
@Zekfad Hello! Please make 2 separated PR for each functionality |
Author
|
Thanks for feedback! I'll split it in a following week. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance improvement: use initializer instead of late initialization and polymorph getters
Bugfix for missing error and exception details
Describe the bug
TalkerData#generateTextMessageis missingdisplayExceptionanddisplayError, usesmessageinstead ofdisplayMessagewhich could cause "null" string in logs (intended?).TalkerLog#generateTextMessageis missingdisplayErrorwhich prevents printing errors to console log.To Reproduce
Expected behavior
Summary by Sourcery
Fix missing error and exception details in console logs and optimize TalkerData initialization and constructors
Bug Fixes:
Enhancements: