GithubHelp home page GithubHelp logo

pretty_dio_logger's People

Contributors

carapacik avatar dmakwt avatar marcinoz avatar milad-akarie avatar thila-cs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pretty_dio_logger's Issues

Error

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

Response body is not formatted

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"}

Log timings?

How do we print how much time it took to complete the http call?

Logging in main Thread

When logging long Json responses UI thread freezes. Need to move logging into separate isolate if possible

Please support dio 3.0.0

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

Compacting ResponseType.bytes ?

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:
Screenshot 2022-06-15 at 12 07 39

// etc...

Which I think for this kind of response is easier to read than the output we get from the PrettyDioLogger:
Screenshot 2022-06-15 at 12 09 05

// 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! ☺️

How to use debugPrint

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?

Not working in flutter 3.10.1

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'.

Unnecessary spaces using custom contructor

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, ), );

take_01

In this case, these empty spaces should be removed.

Error: Member not found: 'response'. (after upgrading to dio 5.0.0)

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

Plans to support dio v4.0 ?

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

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

Remove flutter as dependency

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 :)

When using dio.download for a streamed download it crashes

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<…>

Have any option to print log as JSON format?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.