http_extensions_log 0.1.2

http_extensions : log #

An [http extension] that logs requests.

Usage #

final client = ExtendedClient(
  inner: Client(),
  extensions: [
    LogExtension(
        logger: Logger("HTTP"),
        defaultOptions: LogOptions(
          const LogOptions(
            level: Level.fine // The logging level (on logger)
            isEnabled: true, // Indicates whether the logger is enabled.
            logContent: false // Indicates whether sent body and received content should be logged.
            logHeaders: true // Indicates whether headers should be logged.
        )),
  ],
);

0.1.0 #

  • Initial version

example/example.dart

import 'package:http_extensions/http_extensions.dart';
import 'package:http_extensions_log/http_extensions_log.dart';
import 'package:logging/logging.dart';
import 'package:http/http.dart';

main() async {
  // Displaying logs
  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((record) {
    print('${record.loggerName} | ${record.level.name}: ${record.time}: ${record.message}');
  });

  final client = ExtendedClient(
    inner: Client(),
    extensions: [
      LogExtension(
        logger: Logger("Http"),
        defaultOptions: LogOptions(
          logContent: true,
        )
      ),
    ],
  );

  await client.get("http://www.flutter.dev");
  try {
    await client.get("http://www.djdkjskdjgndfkjgnskjgn.dev");
  } catch (e) {
    print("Failed : $e");
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  http_extensions_log: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:http_extensions_log/http_extensions_log.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
39
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

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

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:http_extensions_log/http_extensions_log.dart.

Health suggestions

Format lib/src/extension.dart.

Run dartfmt to format lib/src/extension.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
http ^0.12.0+1 0.12.0+2
http_extensions ^0.1.1 0.1.2
logging ^0.11.3 0.11.3+2
meta ^1.1.6 1.1.7
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6