Last updated:
0 purchases
groveman crashlytics
Groveman Crashlytics #
Tree for the groveman.
It sends your logs to the Firebase Crashlytics.
Usage #
First, configure the Firebase Crashlytics, for it, see the documentation.
By default, if use Groveman.captureErrorInCurrentIsolate, its log level is fatal, this is configurable.
Groveman.captureErrorInCurrentIsolate(logLevel: LogLevel.error);
copied to clipboard
Add it in your pubspec.yaml:
dependencies:
// Only to send the fatal log levels
firebase_analytics:
groveman:
groveman_crashlytics:
copied to clipboard
Import it where you want to use it e.g, in your main file.
import 'package:groveman/groveman.dart';
import 'package:groveman_crashlytics/groveman_crashlytics.dart';
copied to clipboard
Initialize crashlytics tree on start of your application.
void main() {
Groveman.plantTree(DebugTree());
Groveman.captureErrorInZone(() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
if (kReleaseMode) {
Groveman.plantTree(CrashlyticsTree());
}
Groveman.captureErrorInCurrentIsolate();
runApp(const MyApp());
});
}
copied to clipboard
Usually, you only send your logs in production.
By default, the log levels info, warning, error, and fatal are sent to Crashlytics.
Groveman.error(message, error: exception);
copied to clipboard
If the LogRecord.message contains an error, it will be sent using crashlytics.recordError where LogRecord.error is passed as error, LogRecord.stackTrace is passed as stackTrace, LogRecord.message is passed as reason and fatal is true if the LogRecord.level is also fatal, otherwise, is used crashlytics.log, passing the LogRecord.message as message.
To custom, pass the levels that desire to send when creating the Crashlytics Tree.
Groveman.plantTree(
CrashlyticsTree(logLevels: [
LogLevel.warning,
LogLevel.info,
]),
);
);
copied to clipboard
📝 License #
Copyright © 2022 Kauê Martins
This project is MIT licensed
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.