flutter_log_handler 0.0.2 copy "flutter_log_handler: ^0.0.2" to clipboard
flutter_log_handler: ^0.0.2 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 & Monitoring Framework for Flutter

A production-ready logging solution built specifically for Flutter applications.
Designed for scalable apps, internal admin panels, QA builds, and production monitoring.


๐Ÿ”ฅ Why flutter_log_handler? #

Modern Flutter applications need more than print().

They need:

  • Structured logs
  • Persistent storage
  • Crash tracking
  • API monitoring
  • Performance visibility
  • Internal log viewer
  • Controlled retention
  • Shareable diagnostics

flutter_log_handler provides all of that in a lightweight, configurable, and extensible architecture.


๐Ÿš€ Core Capabilities #

๐Ÿ“Œ Structured Logging #

Clean log model with levels, timestamps, routes and stack traces.

๐Ÿ—‚ File Persistence #

Logs saved locally with configurable directory & file name.

๐Ÿง  In-Memory Log Store #

Fast access without reading file every time.

๐Ÿ“Š Professional Log Viewer UI #

Built-in log screen with:

  • Filtering by level
  • Expandable stack traces
  • Refresh support
  • Share logs
  • Clean enterprise UI

๐Ÿ’ฅ Automatic Crash Capture #

Capture:

  • Flutter framework errors
  • Unhandled runtime exceptions
  • Zoned errors

๐ŸŒ Dio API Interceptor #

Automatic logging of:

  • Requests
  • Responses
  • Slow APIs
  • API errors
  • Duration tracking

๐Ÿงน Retention & Log Limit Control #

  • Maximum log count
  • Retention days support
  • File rotation ready architecture

๐ŸŽฏ Ideal For #

  • Enterprise Flutter apps
  • Production builds
  • QA debugging
  • Internal monitoring dashboards
  • Crash diagnostics
  • API performance tracking
  • White-label client apps

๐Ÿ“ฆ Installation #

dependencies:
  flutter_log_handler: ^0.0.2
flutter pub get

โš™๏ธ Quick Setup #

1๏ธโƒฃ Initialize Logger #

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

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

  await LogService.to.getLogs();

  runApp(const MyApp());
}

## ๐Ÿ” Sensitive Data Masking

flutter_log_handler automatically masks sensitive fields such as:

- password
- token
- accessToken
- refreshToken
- authorization
- apiKey

You can customize this:

LogConfig(
sensitiveKeys: ["password", "secretKey"],
);

๐Ÿ“ Log Events Anywhere #

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

๐Ÿ“ฅ Load Logs Automatically #

await LogService.to.getLogs();

This will:

  • Load logs from file (if enabled)
  • Sync logs into memory
  • Prepare logs for UI display

With Stack Trace #

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

๐Ÿงน Crash Capture Setup #

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

Automatically captures:

  • Flutter framework errors
  • Unhandled async errors
  • Zone errors

๐ŸŒ API Monitoring (Dio) #

final dio = Dio();

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

Logs:

  • HTTP method
  • URL
  • Response status
  • API duration
  • Slow APIs (>2000ms)
  • Error stack traces

๐Ÿ–ฅ Professional Log Viewer #

Navigator.push(
  context,
  MaterialPageRoute(
    builder: (_) => const MyLogScreen(),
  ),
);

Features:

  • Filter logs by level
  • Expand stack traces
  • Refresh logs
  • Share logs
  • Clean enterprise card layout

๐Ÿ“Š Configuration Options #

LogConfig(
  maxLogs: 500,
  retentionDays: 5,
  enableConsoleLog: true,
  enableFileLog: true,
  fileName: "app_logs.txt",
  directoryName: "logs",
);
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

๐Ÿ“ Storage Location #

ApplicationDocumentsDirectory / directoryName / fileName

Example:

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

๐Ÿ›ก Architecture Highlights #

  • Singleton-based LogService
  • Configurable behavior
  • Zero dependency injection requirement
  • Works with GetX or without it
  • Extendable for cloud upload
  • Future-ready for log rotation

๐Ÿ“ˆ SEO Keywords #

Flutter logger
Flutter crash logger
Flutter file logger
Flutter monitoring tool
Flutter API interceptor
Flutter production logging
Flutter enterprise logging

๐Ÿ† Designed for Production #

flutter_log_handler is built for teams that require reliability, observability, and structured monitoring inside Flutter applications.


๐Ÿ“„ License #

MIT License


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

ASTR Raju
Enterprise Flutter Developer

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, path_provider, share_plus

More

Packages that depend on flutter_log_handler