搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.15

snug_logger

Snug Logger - 舒適、有趣、強大!以簡單與一點樂趣提升您的程式設計體驗。讓記錄日誌變得愉快。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
144
喜歡數
12
Pub 分數
160

安裝套件

flutter pub add snug_logger

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Snug Logger 是一個令人愉悅且強大的 Flutter 日誌套件,專為讓除錯變得愉快且直覺而設計。以舒適、有趣美學為特色,它透過在所有平台提供清晰、彩色且結構化的日誌,提升開發者體驗。支援豐富的輸出格式,並能順暢整合至開發工作流程中。非常適合尋求日誌過程兼具功能性與個性化風格的團隊。

適用情境

  • 應用開發過程中的即時除錯
  • 透過可讀日誌增強團隊合作
  • 監控測試環境中的應用行為
  • 簡化複雜流程中的錯誤追蹤
  • 為日常調試任務增添樂趣

主要特色

  • 色彩豐富且富有表現力的日誌輸出
  • 跨平台支援(Android、iOS、Web、macOS、Windows、Linux)
  • 透過 pub add 的簡單整合
  • 可自訂的日誌層級和樣式
  • 輕量且快速的效能
  • 有趣且引人入勝的開發體驗

適合對象

  • 重視工具美學的Flutter開發者
  • 希望日誌一致且可讀的團隊
  • 開發者優先考慮愉快的除錯
  • 需要輕量級但有效的日誌記錄的項目
  • 尋求標準記錄器有趣替代方案的人

使用建議

  • 不建議在生產記錄中使用,除非進行過濾
  • 在高流量場景下可能過於顯眼
  • 最適合開發和測試階段
  • 與企業級日誌記錄器相比,高級功能有限
  • 視覺風格可能不符合所有團隊的偏好

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Snug Logger 🛋️

Snug_Logger

A colorful, structured logger for Flutter apps.

Snug Logger helps you:

  • read logs faster with clean formatting and colors
  • log by intent (debug, info, error, production)
  • inspect Dio network traffic with optional cURL output
  • get readable stack traces for error debugging

Install

dependencies:
  snug_logger: ^1.0.15
flutter pub get

Quick Start

import 'package:snug_logger/snug_logger.dart';

snugLog('App started', logType: LogType.info);
snugLog('Fetching user profile', logType: LogType.debug);
Error Logging with Stack Trace
try {
  throw Exception('Something went wrong');
} catch (error, stackTrace) {
  snugLog(
    error,
    logType: LogType.error,
    stackTrace: stackTrace,
  );
}

Network Logging (Dio)

_dio.interceptors.add(
  SnugDioLogger(
    requestHeaders: true,
    requestData: true,
    responseHeaders: true,
    responseData: true,
    showCurl: true,
    logPrint: (object) => debugPrint(object.toString()),
  ),
);

When showCurl: true is enabled, Snug Logger prints reproducible cURL commands so you can quickly share failing requests with backend teams.

What You Can Configure

  • requestHeaders: include request headers
  • requestData: include request body/query
  • responseHeaders: include response headers
  • responseData: include response body
  • showCurl: print cURL command for each request

Advanced Stack Trace Utilities

If you want direct control over stack trace formatting:

final formatted = StackTraceFormatter.format(stackTrace);
final terse = StackTraceFormatter.formatTerse(stackTrace);
final snug = StackTraceFormatter.formatForSnugLogger(stackTrace);

Contributing

Thanks to Contributors

Thanks to everyone who contributed features, fixes, docs, and reviews, including the cURL printing enhancement.

Contributor Wall

Contributors

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。