パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v5.0.1

l

シンプルなAPIを備えたクロスプラットフォームのhtml/ioロガーライブラリ。ネイティブおよびWebコンソールで操作できます。ASCIIカラーリング出力をサポートしています。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3220
いいね数
93
Pub ポイント
160

パッケージをインストール

flutter pub add l

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

「l」パッケージは、Flutter向けのクロスプラットフォームログライブラリであり、Android、iOS、Web、macOS、Windows、Linuxでメッセージをログ記録するためのシンプルなAPIを提供します。ネイティブおよびWebコンソールを介した出力操作をサポートし、ログの可読性を高めるために組み込みのASCIIカラーリングを備えています。リアルタイムでのデバッグやアプリケーション動作のモニタリングに最適で、複雑さを加えることなく開発ワークフローにシームレスに統合されます。軽量で、一貫性があり、カラフルかつプラットフォーム非依存のログ記録が必要な開発者向けに設計されています。

用途

  • 複数プラットフォーム間でのリアルタイムデバッグ
  • より良いログの可視性のためのカラーコンソール出力
  • 開発およびテストにおけるシンプルな統合
  • クロスプラットフォームのログの一貫性
  • 開発中のアプリケーション動作の監視
  • ウェブおよびモバイルアプリを同時にデバッグする

主な機能

  • シンプルで直感的な API
  • ASCIIカラーアウトプット
  • すべての主要なFlutterプラットフォームをサポートしています
  • ネイティブおよびWebコンソールの互換性
  • 軽量で高速
  • flutter pub add で簡単セットアップ

適している対象

  • 簡単なログ記録を求めるFlutter開発者
  • マルチプラットフォームアプリを開発するチーム
  • デバッグ効率に注力する開発者
  • カラフルなコンソール出力を必要とするプロジェクト
  • 最小限のボイラープレートログを望む人
  • フロントエンドおよびバックエンドのデバッグログ

注意事項

  • 本番ログ用ではありません
  • 色の出力は、すべての環境でレンダリングされない可能性があります
  • 制限された構成オプション
  • 開発用途に最適
  • 大規模なアプリでは追加のフィルタリングが必要になる場合があります
  • コンソールの利用可能性に依存します

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

[L]ogger

Pub Actions Status Coverage License: MIT Linter GitHub stars

About

Cross-platform html/io logger with simple API. No need to create a logger object. Just import and use. Simple and w/o boilerplate. Work with native console.

Core API

Example of usage

Example of using the library to display a message in the console.

Key features
Method Description
[s] A shout is always displayed
[v1], [v] Regular message with verbose level 1
[e] Error message with verbose level 1
[v2], [vv] Regular message with verbose level 2
[w] Warning message with verbose level 2
[v3], [vvv] Regular message with verbose level 3
[i], [<] Inform message with verbose level 3
[v4], [vvvv] Regular message with verbose level 4
[d], [<<] Debug message with verbose level 4
[v5], [vvvvv] Regular message with verbose level 5
[v6], [vvvvvv] Regular message with verbose level 6
l.s('shout me');
l.e('error msg');
l.w('warning msg');
l.i('info msg');
l < 'alt info msg';
l.d('debug msg');
l << 'alt debug msg';
l.v('verbose lvl #1');
l.vv('verbose lvl #2');
l.vvv('verbose lvl #3');
l.v4('verbose lvl #4');
l.v5('verbose lvl #5');
l.v6('verbose lvl #6');
Integration capabilities
Method Description
[listen] Broadcast stream receiving logs.
// Broadcast stream instantly receiving logs.
l.forEach((log) => print('* ${log.level} : ${log.message}'));
Print handling and customizing

Logger supports fine-tuning with the second argument LogOptions in a capture method. Also, you can handle print and output with l on some function or in a whole app with this simple syntax:

import 'package:l/l.dart';

void main() => l.capture(
      someFunction,
      const LogOptions(
        handlePrint: true,
        printColors: true,
        outputInRelease: false,
        messageFormatting: _messageFormatting,
      ),
    );

Future<void> someFunction() async {
  print('Hello');
  await Future<void>.delayed(const Duration(milliseconds: 150));
  l.d('world');
  await Future<void>.delayed(const Duration(milliseconds: 150));
  l.e('!!!');
}

Object _messageFormatting(Object message, LogLevel logLevel, DateTime now) =>
    '${now.hour}:${now.minute.toString().padLeft(2, '0')} $message';

Handling errors

Flutter
final sourceFlutterError = FlutterError.onError;
FlutterError.onError = (details) {
  l.w(details.exceptionAsString(), details.stack);
  sourceFlutterError?.call(details);
};
Crashlytics
l.where((msg) => msg.level.maybeWhen(
      error: () => true,
      warning: () => true,
      orElse: () => false,
    ))
  .map<String>((msg) => msg.message.toString())
  .listen(FirebaseCrashlytics.instance.log);
Zoned Errors
runZonedGuarded(someFunction, l.e);
Handling uncaught errors
Isolate.current
       ..setErrorsFatal(false)
       ..addErrorListener(
         RawReceivePort(
           (List<dynamic> pair) => // ignore: avoid_types_on_closure_parameters
               l.e(pair.first as Object),
         ).sendPort,
       );

Limitations

  • When there is no direct access to the terminal, it works through print.
  • !!! PLEASE, DO NOT LOG SENSITIVE INFORMATION !!!

Changelog

Refer to the Changelog to get all release notes.

Maintainers

Plague Fox

Funding

If you want to support the development of our library, there are several ways you can do it:

We appreciate any form of support, whether it's a financial donation or just a star on GitHub. It helps us to continue developing and improving our library. Thank you for your support!

License

MIT

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。