Last updated:
0 purchases
logman
Logman #
A simple yet powerful logging package for Flutter apps with an integrated UI and an optional debug page.
Features #
Easy-to-use logging with a singleton pattern.
Supports various log types: simple, navigation, and network logs.
Customizable floating UI overlay to display logs in development.
Optional debug page for detailed log analysis.
Dio interceptor for network logging.
Navigator observer for tracking navigation events.
Screenshots #
Installation #
Add Logman to your pubspec.yaml file:
dependencies:
logman: ^[latest_version]
copied to clipboard
Replace [latest_version] with the latest version of Logman.
Install it:
flutter packages get
copied to clipboard
Import it in your Dart code:
import 'package:logman/logman.dart';
copied to clipboard
Usage #
Initialize Logman in your app's root (after MaterialApp) and use its instance throughout your app.
Attach the Overlay:
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
logman.attachOverlay(
context: context,
debugPage: // Your optional debug page,
button: // Your optional custom button,
maxLogLifetime: // Set the maximum lifetime of a single log record,
maxLogCount: // Set the maximum number of log records to keep,
);
});
}
copied to clipboard
You can also hide the overlay using the showOverlay property like so.
logman.attachOverlay(
context: context,
showOverlay: false,
);
copied to clipboard
This can be useful when you want to hide the overlay in production. Also you can also disable logs
using the printLogs property like so.
logman.attachOverlay(
context: context,
printLogs: false,
recordLogs: false,
);
copied to clipboard
Log events
There are 3 types of logs currently (simple , navigation, and network).
For logging simple (info) logs:
final Logman _logman = Logman.instance;
_logman.info('test');
copied to clipboard
There's a Dio interceptor ready for use in the example app.
Also, Logman ships with a Navigator Observer. You can use it like this in your MaterialApp.
MaterialApp(
title: 'Logman Demo',
theme: ...,
home: const MyHomePage(title: 'Logman Demo Home Page'),
navigatorObservers: [
LogmanNavigatorObserver(), // Navigator observer
],
)
copied to clipboard
Example #
Find a complete example here.
Contributing #
We welcome contributions! Please read our contribution guidelines for more information.
Find this useful? Give our repo a star ⭐ ⬆️.
License #
Logman is released under the Apache 2.0 License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.