Skip to content
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

Show full untruncated messages from dart:developer log() #2683

Closed
szotp opened this issue Jul 30, 2020 · 2 comments
Closed

Show full untruncated messages from dart:developer log() #2683

szotp opened this issue Jul 30, 2020 · 2 comments
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Milestone

Comments

@szotp
Copy link
Contributor

szotp commented Jul 30, 2020

developer.log output is truncated so much that it's almost useless. IMO it would be better to just print entire thing - if I wanted to truncate, I could do it before calling the log method.

import 'dart:developer';

void main(List<String> arguments) {
  const text1 =
      "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

  final text2 =
      Iterable.generate(100, (i) => 'Lorem ipsum dolor sit amet').join('\n');

  log(text1);
  log(text2);
}

Outputs:

[log] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut e…
[log] Lorem ipsum dolor sit amet
      Lorem ipsum dolor sit amet
      Lorem ipsum dolor sit amet
      Lorem ipsum dolor sit amet
      Lorem ipsum dolor si…
Exited

I suspect that this line needs to be changed:

const message = (record.message.valueAsString || "<empty message>")

To use fullValueAsString:

const message = await this.fullValueAsString(event.isolate, record.error);

I'm going to try if it works and submit MR.

I also checked on Android studio and did not have this truncation.

@DanTup
Copy link
Member

DanTup commented Jul 30, 2020

On the surface that seems like a reasonable change to me. There's a test here you might want to extend/copy with a longer message:

dc.assertOutputContains("console", `${grey("[log] ")}Logging from dart:developer!`),

Thanks!

@DanTup DanTup added this to the v3.14.0 milestone Jul 30, 2020
@DanTup DanTup added is enhancement in debugger Relates to the debug adapter or process of launching a debug session labels Jul 30, 2020
@DanTup DanTup changed the title developer.log is truncated too much Show full untruncated messages from dart:developer log() Jul 30, 2020
@szotp
Copy link
Contributor Author

szotp commented Jul 30, 2020

PR sent #2684

@szotp szotp closed this as completed Jul 30, 2020
@DanTup DanTup modified the milestones: v3.14.0, v3.13.0 Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants