flutter_logan 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

flutter_logan #

This is a plugin privide an ability to use Logan in Flutter like native.It use MethodChannel to call method implement by Logan.so the native part of Logan is required.But there is no need to worry,Logan is a lightweight log system,it will not significantly make your package volume larger.

Getting Started #

How to use? It is important to call init befor use Logan, you cant call init either in Flutter(FlutterLogan.init) or in native(loganInit).

Init #

important!!! you must replace this key and iv by your own.change key and iv at new version is more secure. we will provide a more secure way to protect your logs in the future.

	String result = 'Failed to init log';
    try {
      final bool back = await FlutterLogan.init(
          '0123456789012345', '0123456789012345', 1024 * 1024 * 10);
      if (back) {
        result = 'Init log succeed';
    } on PlatformException {
      result = 'Failed to init log';

Usage #

Write a log:

	String result = 'Write log succeed';
    try {
      await FlutterLogan.log(10, 'this is log string');
    } on PlatformException {
      result = 'Failed to write log';

If you want to write log to file immediately, you need to call flush function:

 	String result = 'Flush log succeed';
    try {
      await FlutterLogan.flush();
    } on PlatformException {
      result = 'Failed to flush log';

you can use this method to upload your logs directly into your server. we also provide logan server source code ,you can find it in Logan open souce Repository.

	String result = 'Failed upload to server';
    try {
      final today = DateTime.now();
      final date = "${today.year.toString()}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')}";
      final bool bakc = await FlutterLogan.upload(
      if (bakc) {
        result = 'Upload to server succeed';
    } on PlatformException {
      result = 'Failed upload to server';

Logan provides a method for obtaining log files and performs preprocessing operations on the logs that need to be uploaded. Log can be uploaded by implementing the network upload function.

 	String result;
    try {
      final today = DateTime.now();
      final date = "${today.year.toString()}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')}";
      final String path = await FlutterLogan.getUploadPath(date);
      if (path != null) {
        result = 'upload path = ' + path;
      } else {
        result = 'Failed to get upload path';
    } on PlatformException {
      result = 'Failed to get upload path';
	// implement your own method to upload

Use this method to delete all logs

	String result = 'Clean log succeed';
    try {
      await FlutterLogan.cleanAllLogs();
    } on PlatformException {
      result = 'Failed to clean log';

1.0.0 #


flutter_logan_examle #

This is a demo shows how to use fultter_logan plugin in flutter.

How to run this demo? #

You can use Visual Studio Code or Xcode to run this project. Xcode: cd ~/your path/flutter_logan/example flutter build ios (you shuld install flutter first) open ios/Runner.xcworkspace

Use this package as a library

1. Depend on it

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

  flutter_logan: ^1.0.2

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:flutter_logan/flutter_logan.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_logan.dart.

Run flutter format to format lib/flutter_logan.dart.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/Meituan-Dianping/Logan/Futter was unreachable.


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