Skip to content

Conversation

devoncarew
Copy link
Member

  • improve the display of json in the logging view
  • improve gc event formatting

@DanTup

_data = value;

if (_data != null) {
// TODO(dantup): Can we format the JSON better?
message.text = _data.message;
final String str = _data.message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There are a usages of both _data.message and str below here, maybe they should be the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - good catch; cleanup this up a bit.

@@ -331,11 +343,24 @@ class LogDetailsUI extends CoreElement {
LogData get data => _data;

set data(LogData value) {
// TODO(devoncarew): Reset the vertical scroll value if any.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably content.element.scrollTop = 0; but I don't have it set up on this machine to test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that works!

'isolate': e.json['isolate'],
};
final String message = jsonEncode(event);
_log(new LogData('gc', message, e.timestamp, summary: summary));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any value in having LogData hold the JSON (here we decode it and re-encode it, and then in the display we repeat the same)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't currently have access to it, but I do agree that there's no need to decode and re-encode; will see what we can clean up here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this specific case, we're displaying a slightly modified event object.

try {
// If the string decodes properly, than format the json.
final dynamic result = jsonDecode(str);
message.text = jsonEncoder.convert(result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the logs potentially ever include strings that are JSON that we don't want to re-format? (for ex. if users logs can appear in this view, do we want their JSON to be reformatted? it might be confusing, though also it could be useful?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a close approx. to what we want, but definitely will be over-helpful in certain cases. Perhaps - when this is more mature - having a toggle in the details area as to whether to interpret the data at all?

@devoncarew devoncarew merged commit ff00313 into flutter:master Sep 21, 2018
hrajwade96 pushed a commit to hrajwade96/devtools that referenced this pull request Dec 18, 2024
hrajwade96 pushed a commit to hrajwade96/devtools that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants