Skip to content

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

Closed

Description

@szotp

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.

Activity

  1. DanTup commented on Jul 30, 2020

    @DanTup
    Member

    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!

  2. added this to the v3.14.0 milestone on Jul 30, 2020
  3. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Jul 30, 2020
  4. changed the title [-]developer.log is truncated too much[/-] [+]Show full untruncated messages from dart:developer log()[/+] on Jul 30, 2020
  5. szotp commented on Jul 30, 2020

    @szotp
    ContributorAuthor

    PR sent #2684

  6. modified the milestones: v3.14.0, v3.13.0 on Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions