snug_logger 1.0.15 copy "snug_logger: ^1.0.15" to clipboard
snug_logger: ^1.0.15 copied to clipboard

Snug Logger - Cozy, Fun, Powerful! Elevate your coding with simplicity and a touch of fun. Logging made delightful.

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

11
likes
160
points
395
downloads

Publisher

verified publisherwebmobtech.com

Weekly Downloads

Snug Logger - Cozy, Fun, Powerful! Elevate your coding with simplicity and a touch of fun. Logging made delightful.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter

More

Packages that depend on snug_logger