flutter_log_handler 0.0.4 copy "flutter_log_handler: ^0.0.4" to clipboard
flutter_log_handler: ^0.0.4 copied to clipboard

Enterprise-grade logging solution for Flutter applications. Provides console logging, file persistence, crash capturing, Dio API interception, retention control, and a built-in professional log viewer UI.

flutter_log_handler #

Enterprise-Grade Logging, Crash Tracking & API Monitoring Framework for Flutter

A production-ready logging infrastructure built specifically for modern Flutter applications.

Designed for enterprise apps, production builds, QA testing, white-label solutions, admin dashboards, and scalable client deployments.


Flutter Platform License


๐Ÿš€ Why flutter_log_handler? #

print() is not production logging.

Modern Flutter apps require:

  • Structured logging
  • Persistent log storage
  • Crash monitoring
  • API request/response tracking
  • Slow API detection
  • Secure data masking
  • Log retention management
  • Professional internal log viewer
  • Shareable diagnostics for QA

flutter_log_handler delivers a complete observability layer inside your Flutter application.

Lightweight. Configurable. Enterprise-ready.


๐ŸŽฏ Ideal For #

  • Enterprise Flutter applications
  • Production monitoring
  • QA builds
  • Internal admin tools
  • Crash diagnostics
  • API performance tracking
  • White-label client deployments
  • Large-scale apps requiring structured logs

๐Ÿ”ฅ Core Features #

๐Ÿ“Œ Structured Logging System #

  • Log levels: info, warning, error
  • Timestamp tracking
  • Route tracking
  • API endpoint tracking
  • Stack trace support
  • Custom tags support

๐Ÿ—‚ File-Based Log Persistence #

  • Stores logs locally
  • Configurable directory name
  • Configurable file name
  • Secure storage inside app documents directory

๐Ÿง  In-Memory Log Store #

  • Fast access without file read
  • Efficient filtering
  • High-performance UI rendering
  • Controlled max log limit

๐Ÿ’ฅ Automatic Crash Capture #

Captures:

  • Flutter framework errors
  • Unhandled runtime exceptions
  • Async errors
  • Zoned errors

Now supports automatic crash tagging with:

  • Device info
  • Platform

๐ŸŒ Dio API Interceptor #

Automatically logs:

  • HTTP method
  • API endpoint
  • Request body (sanitized)
  • Response body (sanitized)
  • Status code
  • API duration
  • Slow APIs
  • Error stack traces

Built-in slow API detection threshold.


๐Ÿ” Sensitive Data Masking #

Automatically masks sensitive keys such as:

  • password
  • token
  • accessToken
  • refreshToken
  • authorization
  • apiKey

Customizable via configuration.

Prevents leaking sensitive data in production logs.


๐Ÿ–ฅ Professional Log Viewer UI #

Built-in enterprise log screen with:

  • Level filtering
  • Expandable stack traces
  • Pull-to-refresh
  • Share logs
  • Clean card-based UI
  • Production-friendly design

๐Ÿงน Retention & Storage Control #

  • Maximum log count control
  • Retention days support
  • Auto-deletes old logs
  • File rotation ready architecture

๐Ÿ“ฆ Installation #

dependencies:
  flutter_log_handler: ^0.0.4

Then run:

flutter pub get

โš™๏ธ Quick Setup #

1๏ธโƒฃ Initialize Logger in main() #

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  LogService.init(
    const LogConfig(
      maxLogs: 1000,
      retentionDays: 7,
      enableConsoleLog: true,
      enableFileLog: true,
      fileName: "app_logs.txt",
      directoryName: "logs",
      sensitiveKeys: ["password", "secretKey"],
    ),
  );

  await LogService.to.getLogs();

  runApp(const MyApp());
}

๐Ÿ“ Logging Anywhere in Your App #

LogService.to.logEvent(
  message: "User logged in",
  level: LogLevel.info,
);

With Stack Trace #

LogService.to.logEvent(
  message: error.toString(),
  level: LogLevel.error,
  stackTrace: stack.toString(),
);

With API Endpoint Tracking #

LogService.to.logEvent(
  message: "API Failed",
  level: LogLevel.error,
  stackTrace: stack.toString(),
  apiEndpoint: "/api/login",
);

๐Ÿ’ฅ Crash Capture Setup #

await CrashWrapper.initialize(
  logService: LogService.to,
);

Automatically captures:

  • Flutter framework errors
  • Unhandled async errors
  • Zone errors
  • Device & platform metadata

๐ŸŒ API Monitoring with Dio #

final dio = Dio();

dio.interceptors.add(
  ApiInterceptor(LogService.to),
);

Logs:

  • Request method
  • Endpoint
  • Request body (masked)
  • Response status
  • Duration
  • Slow API warnings
  • API errors with stack traces

๐Ÿ–ฅ Open Log Viewer Screen #

Navigator.push(
    context,
    MaterialPageRoute(
    builder: (_) => const MyLogScreen(
            title: "App Logs",
            noLogsMessage: "No logs found",
            dateFormat: "EEE, MMM dd yyyy hh:mm a",
            levelColors: {
            LogLevel.info: Colors.blue,
            LogLevel.warning: Colors.orange,
            LogLevel.error: Colors.red,
            },
            showChipIndicator: true,
            deleteDialogTitle: "Delete Logs",
            deleteDialogMessage: "Are you sure you want to delete all logs?",
            deleteDialogConfirmText: "Delete",
            deleteDialogCancelText: "Cancel",
          ),
    ),
);

Features:

  • Filter by log level
  • Expand stack traces
  • Refresh logs
  • Share logs
  • Enterprise UI design

๐Ÿ“Š Configuration Options #

LogConfig(
  maxLogs: 500,
  retentionDays: 5,
  enableConsoleLog: true,
  enableFileLog: true,
  fileName: "app_logs.txt",
  directoryName: "logs",
  sensitiveKeys: ["password", "secretKey"],
);
Parameter Description
maxLogs Maximum logs stored in memory
retentionDays Auto-delete logs older than X days
enableConsoleLog Print logs in debug console
enableFileLog Persist logs to file
fileName Log file name
directoryName Folder inside app documents
sensitiveKeys Keys automatically masked to protect sensitive data

๐Ÿ“ Log Storage Location #

ApplicationDocumentsDirectory / directoryName / fileName

Example:

/data/user/0/com.example.app/documents/logs/app_logs.txt

๐Ÿ›ก Architecture Highlights #

  • Singleton-based LogService
  • No dependency injection required
  • Works with GetX or without it
  • Easily extendable to cloud upload
  • Enterprise-grade modular structure
  • Production-safe logging behavior

๐Ÿ“ˆ SEO Keywords #

Flutter logger
Flutter crash logger
Flutter file logger
Flutter API interceptor
Flutter production monitoring
Flutter enterprise logging
Flutter monitoring framework
Flutter error tracking
Flutter debugging tool
Flutter performance monitoring


๐Ÿ† Designed for Production #

flutter_log_handler is built for teams that require reliability, observability, structured diagnostics, and production-safe logging inside Flutter applications.

If you're building serious apps โ€” this package is built for you.


๐Ÿ“„ License #

MIT License


๐Ÿ‘จโ€๐Ÿ’ป Maintainer #

ASTR Raju
Enterprise Flutter Developer

GitHub: https://github.com/ASTR001

1
likes
0
points
508
downloads

Publisher

unverified uploader

Weekly Downloads

Enterprise-grade logging solution for Flutter applications. Provides console logging, file persistence, crash capturing, Dio API interception, retention control, and a built-in professional log viewer UI.

Repository (GitHub)
View/report issues

Topics

#logging #debugging #monitoring #crash-reporting

License

unknown (license)

Dependencies

dio, flutter, get, intl, path_provider, share_plus

More

Packages that depend on flutter_log_handler