milad-akarie / pretty_dio_logger Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello pls update this package with null safety support
020-01-09 21:27:36.990 I: ╔╣ Response ║ POST ║ Status: 200 OK
2020-01-09 21:27:36.990 I: ║ https://-------------------------/Feed/SavePost
2020-01-09 21:27:36.990 I: ╚══════════════════════════════════════════════════════════════════════════════════════════
2020-01-09 21:27:36.990 I: ╔ Body
2020-01-09 21:27:36.990 I: ║
2020-01-09 21:27:36.997 I: @@@ onButtonShareClick error=DioError [DioErrorType.DEFAULT]: type 'int' is not a subtype of type 'String'
2020-01-09 21:27:36.997 I: #0 PrettyDioLogger._printResponse (package:pretty_dio_logger/pretty_dio_logger.dart:145:30)
2020-01-09 21:27:36.997 I: #1 PrettyDioLogger.onResponse (package:pretty_dio_logger/pretty_dio_logger.dart:121:7)
2020-01-09 21:27:36.997 I: #2 DioMixin._request._interceptorWrapper... (package:dio/src/dio.dart:828:37)
2020-01-09 21:27:36.997 I: #3 DioMixin.checkIfNeedEnqueue (package:dio/src/dio.dart:1099:22)
2020-01-09 21:27:36.997 I: #4 DioMixin._request._interceptorWrapper.. (package:dio/src/dio.dart:825:22)
2020-01-09 21:27:36.998 I: #5 new Future. (dart:async/future.dart:176:37)
2020-01-09 21:27:36.998 I: #6 _rootRun (dart:async/zone.dart:1122:38)
2020-01-09 21:27:36.998 I: #7 _CustomZone.run (dart:async/zone.dart:1023:19)
2020-01-09 21:27:36.998 I: #8 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
2020-01-09 21:27:36.998 I: #9 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
2020-01-09 21:27:36.998 I: #10 _rootRun (dart:async/zone.dart:1126:13)
2020-01-09 21:27:36.998 I: #11 _CustomZone.run (dart:async/zone.dart:1023:19)
2020-01-09 21:27:36.998 I: #12 _CustomZone.bindCallback. (dart:async/zone.dart:949:23)
2020-01-09 21:27:36.998 I: #13 Timer._createTimer. (dart:async-patch/timer_patch.dart:23:15)
2020-01-09 21:27:36.998 I: #14 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
2020-01-09 21:27:36.998 I: #15 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
2020-01-09 21:27:36.998 I: #16 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
import 'dart:async';
import 'package:chainformation/database/dao/user_dao.dart';
import 'package:dio/dio.dart';
import 'package:dio/dio.dart' as dio;
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
class HttpClient {
UserDao userDao;
Map<String, dynamic> headers;
Dio httpClient;
HttpClient({UserDao this.userDao}) {
/*
var _logInterceptor = PrettyDioLogger(
requestHeader: true,
requestBody: true,
responseBody: true,
responseHeader: false,
compact: false,
error: false);
*/
var _logInterceptor=LogInterceptor(responseBody: true, requestBody: true);
headers = {
"Fic-App-Version": "4.0.0",
"Accept": "application/json",
"content-type": "application/json"
};
httpClient = Dio();
httpClient.interceptors.add(_logInterceptor);
}
Future get(String url) async {
if (userDao != null) {
var user = await userDao.getLoginUser();
if (user != null && user.tokenId != null) {
String authToken = user.tokenId;
headers["Authorization"] = "Basic " + authToken;
}
}
var response = httpClient.get(url,
options: dio.Options(
headers: headers,
));
return response;
}
}
var _logInterceptor=LogInterceptor(responseBody: true, requestBody: true);
this workin good for me
pretty_dio_logger: ^1.0.8
the body should be formatted but
It is coming as follows:
Body
║
║ {"data":{"logo":"https://onboarding.thecloud.ae/get_file.php?id=f2b813f3da03ccb37ff7e621a7bf2551&_public","domain":"h
║ ttps://www.facegfbook.com/kfcaasd","theme":"#ba7ede","terms":"
ghfhfghfghfghfhgfhgf hgfhgf ggggggggggg </b>gttt
║ tt tsdfsdf </u>f sfsdfdsfsfe yu tyurt
</p>","privacy":"
ewrwervwewrewrv </b>wlrlkgjhkjhdkfgnldf hgskfdg
║ kjhfdglkjsdfhgkjs </u>hdglkjfdkjgdsh
</p>","facebook":"https://www.facebook.com/www","instagram":"https://www.
║ instagram.com/ew/","twitter":"https://twitter.com/werwrw","phone":"4354353","email":"[email protected]"},"row_count":0,"to
║ tal_row_count":0,"status":"success"}
║
Hi, the answer in cfug/dio#687 have no longer work, can you add the options which will log the additional curl of the request ?
How do we print how much time it took to complete the http call?
can we add different colors in response, request & etc.
with the option of changing the color, it would be great feautre.
like this one :
When logging long Json responses UI thread freezes. Need to move logging into separate isolate if possible
I want to omit logging of Uint8List
because such bodies can be several megabytes long and its heavily impact perfomance in debug mode. For example, if dio_image_provider is used or when uploading files.
But I still want to see my JSON requests and responses.
The default PrettyDioLogger
extends from Interceptor
, but if I have concurrent requests It would be better if we have QueuedPrettyDioLogger
that extends from QueuedInterceptorsWrapper
.
We have released version 3.0 of Dio, could you support it ?We may archive this plugin in the Dio documentation after it supports Dio 3.0. thanks
Hi, I was wondering if there's a way of compacting the ResponseType.bytes?
Previously I was using my own logger and was able to see it like follows:
// etc...
Which I think for this kind of response is easier to read than the output we get from the PrettyDioLogger:
// etc...
(It's like 9k lines being printed)
Is there a way of compacting only this kind of outputs?
I love the PrettyDioLogger in general, but I guess this could be just an improvement :)
Thanks a lot!
I want to use the recommended debugPrint as logPrint option:
_dio.interceptors.add( PrettyDioLogger( logPrint: debugPrint ), )
However, I get an error that it is not valid because debugPrint is of the wrong type:
The argument type 'void Function(String?, {int? wrapWidth})' can't be assigned to the parameter type 'void Function(Object)'.dart(argument_type_not_assignable)
How is this intended to work?
Some times the request body is too long to show.
Error (Xcode): ../../../../.pub-cache/hosted/pub.dev/pretty_dio_logger-1.2.0-beta-1/lib/pretty_dio_logger.dart:89:36: Error: Member not found: 'response'.
There are empty spaces, which I believe come from responseBody, when I set responseBody: false.
dio.interceptors.add( PrettyDioLogger( requestHeader: false, requestBody: true, responseBody: false, responseHeader: false, error: true, compact: true, maxWidth: 90, ), );
In this case, these empty spaces should be removed.
Hi,
i get this error today after upgrading to dio 5.0.0
/C:/Users/pc/AppData/Local/Pub/Cache/hosted/pub.dev/pretty_dio_logger-1.2.0-beta-1/lib/pretty_dio_logger.dart:89:36: Error: Member not found: 'response'.
if (err.type == DioErrorType.response) {
^^^^^^^^
Target kernel_snapshot failed: Exception
i think that DioErrorType.response is removed from dio 5.0.0 and replaced by DioErrorType.badResponse
The beta of the v4.0.0 is already available and should transition to a final version in les than a week.
They made a certain number of change to their API that breaks compatibility.
By the way thank you for this package it's really helpful.
Add filter to enable or not example:
bool Function(OptionsRequest) filterBuilder;
to allow enable show only some filter, it will helpful to debug in big project
Thanks
Hi, I am interested to use this library. But I can not use it for my dart application since it is has flutter as dependency. But when I tried to look into the code, it did not use any flutter related packages.
Care to remove flutter as dependency?
I can work on it and make a PR if you want to :)
I'm using an instance of dio with custom configurations for all my app requests, I have responseBody logging enabled, which works perfectly for most of my requests.
Unfortunately for dio.download it crashes because body is not a String.
type 'ResponseBody' is not a subtype of type 'String'
#0 PrettyDioLogger._printResponse (package:pretty_dio_logger/pretty_dio_logger.dart:148:30)
#1 PrettyDioLogger.onResponse (package:pretty_dio_logger/pretty_dio_logger.dart:124:7)
#2 DioMixin._request._interceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio.dart:828:37)
#3 DioMixin.checkIfNeedEnqueue (package:dio/src/dio.dart:1099:22)
#4 DioMixin._request._interceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio.dart:825:22)
#5 new Future.<anonymous closure> (dart:async/future.dart:176:37)
#6 _rootRun (dart:async/zone.dart:1122:38)
#7 _CustomZone.run (dart:async/zone.dart:1023:19)
#8 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#9 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#10 _rootRun (dart:async/zone.d<…>
Dio
version supported by this library is 3.0.5
, please update it to 3.0.6
.
Hey there!
Thank you for your awesome library.
Using your library I can print log like this format:
{
foo: "bar" // foo is here without double quote
}
Have any way to print the JSON with actual format?
{
"foo": "bar" // foo is here inside double quote.
}
I need to print log in JSON format. Is it possible in your library with any configuration? Or have any plan to do something like that?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.