pretty_dio_logger 1.0.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

pretty_dio_logger 1.0.7 #

Pretty Dio logger is a Dio interceptor that logs network calls in a pretty, easy to read format.

Usage #

Simply add PrettyDioLogger to your dio interceptors.

Dio dio = Dio();
dio.interceptors.add(PrettyDioLogger());
// customization 
   dio.interceptors.add(PrettyDioLogger(
        requestHeader: true,
        requestBody: true,
        responseBody: true,
        responseHeader: false,
        error: true,
        compact: true,
        maxWidth: 90));

How it looks like #

VS Code #

Request Example Error Example

Android studio #

Response Example

[1.0.7]

add #

  • log dio form data

[1.0.6]

fix #

  • extra empty block when response logging is disabled (#2).
  • handle none response DioError types.

[1.0.5]

add #

  • support for dio 3.0.3

[1.0.4]

add #

  • support for dio 3.0.1
  • external logging

[1.0.3]

add #

  • query parameters to logging;

[1.0.2+1]

fix #

  • packaging typos.

[1.0.2]

add #

  • support for dio 3.0.0

[1.0.1]

add #

  • VSCode compatibility

[1.0.0]

  • initial release.

example/README.md

import 'package:dio/dio.dart';
import 'package:pretty_dio_logger/pretty_dio_logger.dart';

void main() async {
  Dio dio = Dio();
  dio.interceptors.add(PrettyDioLogger(
    requestHeader: true,
    requestBody: true,
    responseBody: true,
    responseHeader: false,
    compact: false,
  ));

  try {
    await dio.get('http://www.mocky.io/v2/5d7fc75c3300000476f0b557');
  } catch (e) {
    print(e);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pretty_dio_logger: ^1.0.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pretty_dio_logger/pretty_dio_logger.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio >=2.1.9 <=3.0.5 3.0.3
flutter 0.0.0
Transitive dependencies
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.7
path 1.6.4
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test