0 purchases
tracker logger bundle
Flutter Tracker Logger Bundle #
A flutter package that bundles multiple info, event and error trackers and logger libraries to speed up development and debugging.
You just initialize it once with all your API keys and use it agnostically throughout your app.
Currently the following libraries are supported:
MatomoTracker
SentryFlutter
FirebaseAnalytics
FirebaseCrashlytics
Logger (for a prettier debug output)
Getting started #
The simplest way to initialize the Loggers is to initialize the instance on app start. This is best done in main.dart like so:
Future<void> main() async {
// ...
Log.instance.initialize();
// ...
}
copied to clipboard
Add the plugins you like to the initialize function. As a default it only uses the local logger.
If you are using a zoned guard, you can wrap the initialization around your app runner.
In main.dart use the following inside a runZonedGuarded:
Future<void> main() async {
runZonedGuarded<Future<void>>(
() async {
WidgetsFlutterBinding.ensureInitialized();
await Log.instance.initialize(
matomoOptions: const MatomoOptions(siteId: 69, url: 'your matomo url'),
sentryConfig: SentryConfig(
optionsConfiguration: (options) {
// options.dsn = kDebugMode ? '' : F.sentryKey;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
},
appRunner: () => runApp(
const AppEntry(),
),
),
);
},
// This logs to all plugins you specified
(error, stack) async => Log.instance.logError(
'Uncaught error in zonedGuarded',
error: error,
stackTrace: stack,
),
);
}
copied to clipboard
Firebase Analytics #
In order for the plugin to initialize, you need to initialize firebase core. See the firebase analytics docs for more information.
Collaboration #
If you have feedback, improvements, ideas please feel free to reach out. This package is far from perfect but I strive towards a useful convenient helper in you everyday analytics / error logging.
Roadmap / TODOs #
Add consent management somehow in a smart way
Add way more tests
Improve log levels
Improve debug print
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.