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

roggle のカバー
パッケージ詳細v0.4.2+1

roggle

Dart用のシンプルでカラフルかつ拡張しやすいロガー。Loggerにインスパイアされ、Loggerに依存しています。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
254
いいね数
33
Pub ポイント
130

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

flutter pub add roggle

パッケージ概要

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

Roggle は、人気のあるログライブラリにインスパイアされた、シンプルでカラフルかつ拡張しやすい Dart 用のロギングパッケージです。Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームでログを出力するための明確で直感的な API を提供します。鮮やかな色分けとカスタマイズ可能なフォーマットにより、複雑さを加えずにデバッグの可視性を向上させます。軽量な設計により、開発および本番環境での使用に最適であり、特に最小限のセットアップで視覚的に際立つログ体験を求める開発者に適しています。このパッケージは pub.dev を通じて Flutter プロジェクトにシームレスに統合できます。

用途

  • アプリケーションフローのデバッグ
  • 実行時動作の監視
  • 開発中のログの読みやすさの向上
  • クロスプラットフォームログ
  • 既存のプロジェクトへの迅速な統合
  • ログレベルの視覚的区別

主な機能

  • カラフルなコンソール出力
  • シンプルで直感的な API
  • 拡張可能な設計
  • マルチプラットフォーム対応
  • 最小構成
  • ログレベルのフィルタリング

適している対象

  • 視覚的なログの明確さを求める開発者
  • 軽量なログ記録が必要なFlutterアプリ
  • 開発者体験を重視するチーム
  • 読みやすいデバッグ出力が必要なプロジェクト
  • 明確なフィードバックによる高速プロトタイピング
  • 重い依存関係なしのシンプルなログ記録

注意事項

  • 高ボリューム生産ログには適していません
  • フル機能のロガーと比較して、高度な機能が限定的
  • カラーアウトプットは、非端末環境では役に立たない可能性があります
  • コア機能のための外部ロガーに依存しています
  • カスタムフォーマッタ用に追加の設定が必要になる場合があります
  • 開発または低スループットのシナリオで最も効果的に使用されます

元の README

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

logo

Roggle

Test codecov MIT

Simple, colorful and easy to expand logger for dart.
Inspired by the logger and dependent to the logger.

Getting Started

Just create an instance of Roggle and start logging:

import 'package:roggle/roggle.dart';

final logger = Roggle();

logger.d('Roggle is working!');

Instead of a string message, you can also pass other objects like List, Map, Set or Function.

Output

Android Studio

Documentation

Roggle's API is almost the same as the logger. See the logger for basic usage.

Difference from the logger

  • Printer defaults to SinglePrettyPrinter class.
  • Not try-catch at LogOutput class, because we want to stop the process.
  • Added some getters in Roggle class.
  • Changed the log interface dynamic to Object?.

Options

If you use the SinglePrettyPrinter, there are more options:

final logger = Roggle(
  printer: SinglePrettyPrinter(
    loggerName: '[APP]', // Print a logger name for each log message
    colors: true, // Colorful log messages
    printCaller: true, // Print a caller for each log message
    printLocation: true, // Print a location of caller for each log message
    printFunctionName: true, // Print a function name of caller for each log message
    printEmojis: true, // Print an emoji for each log message
    printLabels: true, // Print a level string for each log message
    printTime: true, // Print a timestamp for each log message
    stackTraceLevel:
        Level.error, // The current logging level to display stack trace
    stackTraceMethodCount: 10, // Number of stack trace methods to display
    stackTracePrefix: '>>> ', // Replace stack trace prefix
    levelColors: {}, // Replace level colors map
    levelEmojis: {}, // Replace level emojis map
    levelLabels: {}, // Replace level labels map
    timeFormatter: (now) => DateFormat('yyyy/MM/dd HH:mm:ss.SSS')
        .format(now), // Replace time formatter
  ),
);

SinglePrettyPrinter

You can use the Roggle.crashlytics() to send errors and logs using the FirebaseCrashlytics API in release mode.

final logger = Roggle.crashlytics(
  printer: CrashlyticsPrinter(
    errorLevel: Level.error, // Logs above this level will call onError
    onError: (event) {
      // Send an error to Firebase Crashlytics as follows
      FirebaseCrashlytics.instance.recordError(
        event.exception,
        event.stack,
        fatal: true,
      );
    },
    onLog: (event) {
      // Send logs to Firebase Crashlytics as follows
      FirebaseCrashlytics.instance.log(event.message);
    },
    loggerName: '[APP]',
    printCaller: true, // Print a caller for each log message
    printLocation: true, // Print a location of caller for each log message
    printFunctionName: true, // Print a function name of caller for each log message
    printEmojis: true, // Print an emoji for each log message
    printLabels: true, // Print a level string for each log message
    levelEmojis: {}, // Replace level emojis map
    levelLabels: {}, // Replace level labels map
  ),
);

Tips

If you want to stop the process at the same time as the error log, do the following.

import 'package:roggle/roggle.dart';

final logger = Roggle(
  output: AssertionOutput(),
);

class AssertionOutput extends ConsoleOutput {
  @override
  void output(OutputEvent event) {
    super.output(event);
    if (event.level.index >= Level.error.index) {
      throw AssertionError('Stopped by logger.');
    }
  }
}

License

MIT License

Copyright (c) 2022 Keyber Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

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

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