-
-
Notifications
You must be signed in to change notification settings - Fork 100
Missing error and exception in console logs #388
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
…tters this will remove late initialization checks from runtime and unnecessary getter overloads, which will also make classes more friendly to extension
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
|
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 @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.
String generateTextMessage( | ||
{TimeFormat timeFormat = TimeFormat.timeAndSeconds}) { | ||
return '${displayTitleWithTime(timeFormat: timeFormat)}$message$displayStackTrace'; | ||
return '${displayTitleWithTime(timeFormat: timeFormat)}$displayMessage$displayException$displayError$displayStackTrace'; |
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.
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.
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 ?? ''}'; |
@Zekfad Hello! Please make 2 separated PR for each functionality |
Thanks for feedback! I'll split it in a following week. |
Performance improvement: use initializer instead of late initialization and polymorph getters
Bugfix for missing error and exception details
Describe the bug
TalkerData#generateTextMessage
is missingdisplayException
anddisplayError
, usesmessage
instead ofdisplayMessage
which could cause "null" string in logs (intended?).TalkerLog#generateTextMessage
is missingdisplayError
which 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: