let_log 1.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • new74

let_log #

LetLog is a logger that supports both IDE and in-app display, and supports log and network

Language: English | 中文简体

Getting Started #

API inspired by web

Example code

// log
Logger.log("this is log");

// debug
Logger.debug("this is debug", "this is debug message");

// warn
Logger.warn("this is warn", "this is a warning message");

// error
Logger.error("this is error", "this is a error message");

// test error
try {
  final test = {};
  test["test"]["test"] = 1;
} catch (a, e) {
  Logger.error(a, e);
}

// time test
Logger.time("timeTest");
Logger.endTime("timeTest");

// log net work
Logger.net(
  "api/user/getUser",
  data: {"user": "yung", "pass": "xxxxxx"},
);
Logger.endNet(
  "api/user/getUser",
  data: {
    "users": [
      {"id": 1, "name": "yung", "avatar": "xxx"},
      {"id": 2, "name": "yung2", "avatar": "xxx"}
    ]
  },
);

// log net work
Logger.net("ws/chat/getList", data: {"chanel": 1}, type: "Socket");
Logger.endNet(
  "ws/chat/getList",
  data: {
    "users": [
      {"id": 1, "name": "yung", "avatar": "xxx"},
      {"id": 2, "name": "yung2", "avatar": "xxx"}
    ]
  },
);

// clear log
// Logger.clear();

For a detailed example, please refer to here.

IDE Display results

Let Log

Display logs in the app

Widget build(BuildContext context) {
  return Logger();
}

For a detailed example, please refer to here.

App log

Let Log

App network

Let Log

App search

Let Log

Setting

Custom category names

// setting
Logger.enabled = false;
Logger.config.maxLimit = 50;
Logger.config.reverse = true;
Logger.config.printLog = false;
Logger.config.printNet = false;

// Set the names in ide print, can use emoji.
Logger.config.setPrintNames(
  log: "[😄Log]",
  debug: "[🐛Debug]",
  warn: "[❗Warn]",
  error: "[❌Error]",
  request: "[⬆️Req]",
  response: "[⬇️Res]",
);

// Set the names in the app, can use emoji.
Logger.config.setTabNames(
  log: "😄",
  debug: "🐛",
  warn: "❗",
  error: "❌",
  request: "⬆️",
  response: "⬇️",
);

Results:

Let Log

Feature #

  • [x] Support for both IDE printing and in-app presentation

  • [x] Also supports logging, error, time statistics, network and other information output.

  • [x] Interface imitates the web console class, providing log, debug, warn interface, error, time, endTime, net, endNet, etc.

  • [x] Support for filtering log content by category

  • [x] Support for filtering log content by keywords

  • [x] Support for copy log content

  • [x] Serves as both Http and Socket

  • [x] Statistics for network support packet size, duration

  • [x] Support for custom log category symbols, you can use emoji sentiment as a sort if you like.

  • [x] Multi-colored output logs within the app to make error logs more visible

  • [x] Support for automatic switching between black and white skin according to the app

  • [x] Support for some custom logging settings

github #

https://github.com/yungzhu/let_log

If you like it, give it a star, thanks.

[1.1.3] - 2020-6-29 #

  • Modify head to headers

  • Adjust the spacing to make it look better

[1.1.1] - 2020-6-20 #

  • Add up and down shortcut buttons

  • Click on the search button and the input box automatically gets the focus

[1.0.6] - 2020-6-19 #

  • Add Configuration Options

[1.0.0] - 2020-6-18 #

  • Support for both IDE printing and in-app presentation

  • Also supports logging, error, time statistics, network and other information output.

  • Interface imitates the web console class, providing log, debug, warn interface, error, time, endTime, net, endNet, etc.

  • Support for filtering log content by category

  • Support for filtering log content by keywords

  • Support for copy log content

  • Serves as both Http and Socket

  • Statistics for network support packet size, duration

  • Support for custom log category symbols, you can use emoji sentiment as a sort if you like.

  • Multi-colored output logs within the app to make error logs more visible

  • Support for automatic switching between black and white skin according to the app

  • Support for some custom logging settings

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:let_log/let_log.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      // theme: ThemeData.dark(),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    // setting
    // Logger.enabled = false;
    // Logger.config.maxLimit = 50;
    // Logger.config.reverse = true;
    // Logger.config.printLog = false;
    // Logger.config.printNet = false;

    // Set the names in ide print, can use emoji.
    // Logger.config.setPrintNames(
    //   log: "[😄Log]",
    //   debug: "[🐛Debug]",
    //   warn: "[❗Warn]",
    //   error: "[❌Error]",
    //   request: "[⬆️Req]",
    //   response: "[⬇️Res]",
    // );

    // Set the names in the app, can use emoji.
    // Logger.config.setTabNames(
    //   log: "😄",
    //   debug: "🐛",
    //   warn: "❗",
    //   error: "❌",
    //   request: "⬆️",
    //   response: "⬇️",
    // );

    _test(null);
    Timer.periodic(const Duration(seconds: 5), _test);
    super.initState();
  }

  void _test(_) {
    // log
    Logger.log("this is log");

    // debug
    Logger.debug("this is debug", "this is debug message");

    // warn
    Logger.warn("this is warn", "this is a warning message");

    // error
    Logger.error("this is error", "this is a error message");

    // test error
    try {
      final test = {};
      test["test"]["test"] = 1;
    } catch (a, e) {
      Logger.error(a, e);
    }

    // time test
    Logger.time("timeTest");
    Logger.endTime("timeTest");

    // log net work
    Logger.net(
      "api/user/getUser",
      data: {"user": "yung", "pass": "xxxxxx"},
    );
    Logger.endNet(
      "api/user/getUser",
      data: {
        "users": [
          {"id": 1, "name": "yung", "avatar": "xxx"},
          {"id": 2, "name": "yung2", "avatar": "xxx"}
        ]
      },
    );

    // log net work
    Logger.net("ws/chat/getList", data: {"chanel": 1}, type: "Socket");
    Logger.endNet(
      "ws/chat/getList",
      data: {
        "users": [
          {"id": 1, "name": "yung", "avatar": "xxx"},
          {"id": 2, "name": "yung2", "avatar": "xxx"}
        ]
      },
    );

    // clear log
    // Logger.clear();
  }

  @override
  Widget build(BuildContext context) {
    return Logger();
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  let_log: ^1.1.3

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:let_log/let_log.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
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]
74
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [let_log] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8