LogService is a simple Dart-based logging utility that allows you to log messages, errors, and warnings to a text file. It also enables users to share the log file for troubleshooting purposes. This library is designed for Flutter apps and works well on Android (will be on iOS soon).
Usage
To use this package, add flutter_log_service as a dependency in your pubspec.yaml file.
Features
- Save Log Error to File
- Share Log file easily
- View Saved Logs
- View Filtered Logs based on Date & Log Level
Getting started
Follow this steps to use this package
Install
flutter_log_service: ^1.0.2
How To Use
Import Package
import 'flutter_log_service/flutter_log_service.dart';
Initialize FlutterLogService Class
FlutterLogService logService = FlutterLogService();
now call logService.initLogFile() to create file and access it.
logService.initLogFile();
When any error occurs call this
LogStatus status = await logService.setLog(
errorTitle: "Error Title",
errorMessage: "Error Message",
level: LogLevel.WARNING);
Get Filtered Logs
LogData data = await logService.getFilteredLogs(
logLevel: LogLevel.WARNING,
startDate: DateTime(2023, 8, 1),
endDate: DateTime.now(),
);
Share Log File
await logService.shareLog();
Future Updates
- Save log file to customized location
- Set max file size
- Delete log after specific days limit
- View Filtered Logs based on Date & Log Level
- Save customized log (with extra details)
Developer
Gajendra Somawat
Instagram: gajendra_menaria9
Additional Details
for more details visit example page or contact on Instagram