v1.0.15
snug_logger
Snug Logger - 舒适、有趣、强大!以简单和一丝乐趣提升您的编码体验。让日志记录变得愉悦。
12喜欢 45近 30 天下载160Pub 分数
AndroidiOSWebmacOSWindowsLinux
用于美化 Flutter 应用程序中的日志
以下为英文项目原文快照,最新内容请访问 GitHub。
Snug_Logger
A colorful, structured logger for Flutter apps.
Snug Logger helps you:
debug, info, error, production)dependencies:
snug_logger: ^1.0.15
flutter pub get
import 'package:snug_logger/snug_logger.dart';
snugLog('App started', logType: LogType.info);
snugLog('Fetching user profile', logType: LogType.debug);
try {
throw Exception('Something went wrong');
} catch (error, stackTrace) {
snugLog(
error,
logType: LogType.error,
stackTrace: stackTrace,
);
}
_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.
requestHeaders: include request headersrequestData: include request body/queryresponseHeaders: include response headersresponseData: include response bodyshowCurl: print cURL command for each requestIf you want direct control over stack trace formatting:
final formatted = StackTraceFormatter.format(stackTrace);
final terse = StackTraceFormatter.formatTerse(stackTrace);
final snug = StackTraceFormatter.formatForSnugLogger(stackTrace);
Thanks to everyone who contributed features, fixes, docs, and reviews, including the cURL printing enhancement.