floggy icon indicating copy to clipboard operation
floggy copied to clipboard

[pretty_loggy_dio] Can't pretty log Json/Map and almost every request runs into the print character limit

Open paricleu opened this issue 3 years ago • 1 comments

While using the LoggyDioInterceptor I noticed that my requests always triggered the try/catch block here. The exception thrown is FormatException because

data.toString()

returns the Json without quotes which can't be parsed by

JsonDecoder().convert(...)

I'd suggest using the pretty_dio_logger approach to log as json/Map. The only major difference with pretty_dio_logger is it logs the response line by line instead of using line breaks as this plugin. In my opinion using line breaks is superior because the calls can't be broken up by simultaneous logging calls. However it leads to irritation because long calls (a small json is enough) are being cut of on Android when using the print method(like the DefaultPrinter()) instead of debugPrint(with maxWidth) or developer.log. I'd suggest adding some Info to the readme to stop confusion and issues like #45.

I'll see if I have the time to fix the json issue in the future and mainly opened this issue to get feedback on the linebreak vs print by line approach. What do you think?

paricleu avatar Jan 07 '22 13:01 paricleu

@paricleu Since you are already working on this, is it okay if I assign you to this bug? 😃

lukaknezic avatar Jan 14 '22 15:01 lukaknezic

Closing, the latest release of the flutter_loggy_dio package should resolve this. If the problem persists, feel free to reopen this issue.

zenled avatar Mar 14 '24 11:03 zenled