flutter_log_handler 0.0.3
flutter_log_handler: ^0.0.3 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.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_log_handler/flutter_log_handler.dart';
import 'home_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize Logger
LogService.init(
const LogConfig(
maxLogs: 1000,
retentionDays: 7,
enableConsoleLog: true,
enableFileLog: true,
fileName: "example_logs.txt",
directoryName: "logs",
sensitiveKeys: ["password", "token"],
),
);
await LogService.to.getLogs();
// Enable crash capturing
CrashWrapper.initialize(
logService: LogService.to,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Logger Example",
home: const HomeScreen(),
);
}
}