LogSuite is a Flutter plugin designed to enhance your debugging and monitoring capabilities by capturing screenshots, recording crash logs, and logging network activity. This plugin helps developers ensure their applications run smoothly and provides detailed logs for troubleshooting. LogSuite follows best architectural practices, focusing on functionality and correctness.
Screenshot Capture:
Crash Log Recording:
Network Log Capture:
Custom Log Capture:
Performance Monitoring:
LogSuite follows a modular architecture with a focus on clean code and maintainability. The plugin uses a combination of MVC and BLoC patterns to ensure a clear separation of concerns and to make the codebase easy to navigate and extend.
To use this plugin, add flutter_log_capture
as a dependency in your pubspec.yaml
file:
dependencies:
flutter:
sdk: flutter
flutter_log_capture: ^0.1.0
To initialize the plugin, call the initialize
method in your main
function:
import 'package:flutter/material.dart';
import 'package:flutter_log_capture/flutter_log_capture.dart';
void main() {
FlutterLogCapture.initialize();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'LogSuite Demo',
home: HomePage(),
);
}
}
The sample application demonstrates the integration and usage of the plugin. It includes functionality for:
import 'package:flutter/material.dart';
import 'package:flutter_log_capture/flutter_log_capture.dart';
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('LogSuite Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
// Implement screenshot capture functionality
FlutterLogCapture.captureScreenshot();
},
child: Text('Capture Screenshot'),
),
ElevatedButton(
onPressed: () {
// Trigger a crash for demonstration
throw Exception('Test crash');
},
child: Text('Cause Crash'),
),
ElevatedButton(
onPressed: () {
// Make a network request for demonstration
FlutterLogCapture.logNetworkRequest(
url: 'https://example.com',
method: 'GET',
);
},
child: Text('Make Network Request'),
),
ElevatedButton(
onPressed: () {
// Log a custom message
FlutterLogCapture.logCustomMessage('Custom log message');
},
child: Text('Log Custom Message'),
),
],
),
),
);
}
}
To capture screenshots every 100ms and save them to device storage, ensure the ScreenshotCapture
class in the plugin is properly initialized and running.
Crash logs are automatically captured using the CrashLogRecorder
class. You can retrieve the crash logs through the provided API.
The NetworkLogCapture
class intercepts and logs network requests and responses. These logs are saved to device storage and can be accessed via the API.
Use the CustomLogCapture
class to log custom messages and events. This helps in detailed debugging and tracking specific actions within the app.
The PerformanceMonitor
class logs performance metrics such as CPU and memory usage, providing insights into the app's performance and helping identify optimization areas.
We welcome contributions! Please see the CONTRIBUTING.md file for more details on how to get started.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions or concerns, please open an issue on GitHub or contact me at ranjan.avinash@hotmail.com
.
Thank you for using LogSuite!