IsolateLogger
is a dart based flutter package utility (which uses Isolates under the hood) designed to simplify logging messages into the console and files. It aids developers in tracking user events, exceptions, and other relevant information within their flutter applications.
With IsolateLogger, you can efficiently monitor your application's behavior, identify issues, and improve user experience.
- Console Logging: Easily log messages directly into the console for real-time monitoring and debugging.
- File Logging: Store log messages in files for persistent tracking and analysis, helping you identify patterns and potential problems.
- Isolate Support: Isolate Logger supports logging in Flutter isolates, making it suitable for applications with complex asynchronous workflows.
- Customization: Configure log levels, formats, and file storage locations according to your specific needs.
- Disposal Mechanism: Which helps to clear all references to prevent any memory leak.
- Logs cleanup for specific date Which helps users to setup auto cleanup service after some specific period of time.
To use IsolateLogger in your Flutter project, add the following dependency to your pubspec.yaml
file:
dependencies:
isolate_logger: any
import 'package:isolate_logger/isolate_logger.dart';
// Initialize the logger
IsolateLogger.instance.initLogger(
timeFormat: LogTimeFormat.userFriendly,
logIntoFile: false,
// check for other optional params as well to customize
);
// Use this method to log info. [Check other types as well for logging effectively]
IsolateLogger.instance.logInfo(
tag: "{tag here}",
message: "{message here}",
subTag: "{sub tag here}", // optional param
);
// To clear all logs and its associated files :
IsolateLogger.instance.clearAllLogs();
// To export log files as ZIP, use this :
final result = await IsolateLogger.instance.exportLogs(
exportType: LogsExportType.all, // All & Today are the options for `exportType`
logZipFilePrefix: "zipFilePrefix", // Optional prefix to be consider in zip file name.
);
// To dispose all utility references
IsolateLogger.instance.dispose();
// To cleanup the logs for some specific date
IsolateLogger.instance.clearLogsFor(DateTime.now().subtract(
const Duration(days: 1),
));
- Information :
any information like app events/navigation info etc
- Warning :
any warnings that needs to be logged
- Error :
any error or exception - also has stackTrace as optional param
- Severe :
any severe exception - with mandatory stackTrace to log
I’d love to hear your feedback on this package! If you encounter any bugs or have feature requests, please open an issue.
If you’d like to contribute, feel free to fork the repo, make your improvements, and submit a pull request. Let’s build something amazing together! 🚀