-
Notifications
You must be signed in to change notification settings - Fork 129
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
very long strings are not fully printed ( they are truncated ) #60
Comments
No. There's a period coming in which I can ponder these questions. For one I need to think about the implications of adding a dependency. And the impact of that dependency on all platforms. |
@nateshmbhat you can use my temporary repo as a quick solution https://github.com/trongdth/logger/tree/full_print but I would recommend to wait for author. |
The dependency I'm talking about is "dart:developer" which is built in dart language itself. So I'm pretty sure it won't affect in a negative way |
I've taking some time to muck around with this and I found that The truncation of log lines is because of (Android only?) platform limitations. I believe this to be the offensive line. I've also looked into That leaves us with writing an own solution a la Timber. I believe something like this should/could do the trick. |
Even more digging. Would could copy the heart of the |
I don't know if this is the best solution, but I was able to circumvent this issue by updating the class ConsoleOutput extends LogOutput {
@override
void output(OutputEvent event) {
event.lines.forEach(printWrapped);
}
void printWrapped(String text) {
final pattern = new RegExp('.{1,800}'); // 800 is the size of each chunk
pattern.allMatches(text).forEach((match) => print(match.group(0)));
}
// This works too.
void printWrapped2(String text) => debugPrint(text, wrapWidth: 1024);
} I took the solution from here. |
I'm running into this problem as well. I serialize JSONs into string (using Obviously these formatted strings can get large quickly and the output is trimmed. This issue goes away when I use Still this seems like a rather limitation that I would not expect. Could you improve the package somehow or at least provide a way to remove the limitation via configuration? |
Any news on this? |
@comatory Hi, how did you get the JSON string to print fully? I tried this and it still truncates the string. var j = json.encoder.convert(body);
var logger = Logger(filter: null, printer: PrettyPrinter(), output: null);
logger.d(j); |
@Isuru-Nanayakkara I'm not sure it seemed by just using However in the end I went with @DominicOrga solution. It would be great if this could get fixed by mimicking Flutter's |
Hello guys. Very recently I discovered this library, and this afternoon I encountered the same problem. Luckily, I discovered a workaround. Idea: It is not possible to print a whole line, e.g., a json string without indentation, because at some point it gets truncated. However, it is possible to print multiple lines, e.g., a json with indentation. So, thanks to this answer, it is possible to deserialize the json and then serialize it again, with indent (and log it). Alternatively, you may want to ensure the json strings already are indented in order to avoid the "extra serialization with indent". IMO, the logs are also much clearer if the information in the json string is properly indented. |
You can create custom output for this purpose and thanks to that printer should print longer messages :)
and use it as a custom LogOutput :D
|
Since you are using "print" function in the console printer , it's not fully printing the entire contents of a string.
Dart provides a "log" function from the "dart:developer" package which properly prints the full contents.
i think we should change the print function to the log function. .
The text was updated successfully, but these errors were encountered: