talker 2.1.1-dev.1 talker: ^2.1.1-dev.1 copied to clipboard
Advanced and simple error handler and logger for dart and flutter apps with history, sharing, customization, etc.
Advanced error handler and logger for dart and flutter apps ☎️
Log your app actions, catch and handle exceptions and errors, show alerts and share log reports
Show some ❤️ and star the repo to support the project!
Motivation #
🚀 The main goal of the project provide ability to understand where the error occurs in a short time
✅ Can work with different state managements
✅ Can work with any crash reporting tool (Firebase Crashlytics, Sentry, Your own, etc)
✅ Flutter app logs UI output at screen
✅ Integrated logs and exceptions history
✅ Showing UI exception alerts
Packages #
Talker is designed for any level of customization.
Package | Version | Description |
---|---|---|
talker | Main dart package for logging and error handling | |
talker_flutter | Flutter extensions for talker Colored Flutter app logs (iOS and Android), logs list screen, showing error messages at UI out of the box, route observer, etc |
|
talker_logger | Customizable pretty logger for dart/flutter apps | |
talker_dio_logger | Best logger for dio http calls |
Table of contents #
- Motivation
- Packages
- Get Started
- Get Started Flutter
- Customization
- Talker Flutter
- Features list
- Coverage
- Additional information
Get Started #
Follow these steps to the coolest experience in error handling
Add dependency #
dependencies:
talker: ^2.1.0
Easy to use #
You can use Talker instance everywhere in your app
Simple and concise syntax will help you with this
final talker = Talker();
// Handle exceptions and errors
try {
// your code...
} on Exception catch (e, st) {
talker.handle(e, st, 'Exception with');
}
// Log your app info
talker.info('App is started');
talker.critical('❌ Houston, we have a problem!');
talker.error('🚨 The service is not available');
More examples you can get here
Get Started Flutter #
//TODO:
❗️ Attention ❗️ #
Logs are truncated / cut by the console #
Latest Flutter stable release have print method bug issues/110236
But with Talker you can solve it with passing your own output/print method
If you want to see full logs in console - pass debugPrint as ouput callback method in Talker constructor
final talker = Talker(
loggerOutput: debugPrint,
);
iOS logs colors #
There is a problem with the color palette of logs when launching the app on iOS. In this case, the console cannot read the ansi colors that are used by the library.
For disable colors in iOS application you can setup this loggerSettings field
final talker = Talker(
loggerSettings: TalkerLoggerSettings(
enableColors: !Platform.isIOS,
),
);
⚙️ Customization #
Configure the error handler and logger for yourself
final talker = Talker(
/// Your own observers to handle errors's exception's and log's
/// like Crashlytics or Sentry observer
observers: [],
settings: const TalkerSettings(
/// You can enable/disable all talker processes with this field
enabled: true,
/// You can enable/disable saving logs data in history
useHistory: true,
/// Length of history that saving logs data
maxHistoryItems: 100,
/// You can enable/disable console logs
useConsoleLogs: true,
),
/// Setup your implementation of logger
logger: TalkerLogger(),
///etc...
);
More examples you can get here
Talker Flutter #
Often you need to check what happening in the application when there is no console at hand.
There is a talker_flutter package for this situations.
Get Started with talker_flutter #
Follow these steps to implement talker_flutter in your application
Add dependency #
dependencies:
talker_flutter: ^2.0.6
Easy to use #
You can use TalkerScreen everywhere in your app At Screen, BottomSheet, ModalDialog, etc...
final talker = Talker(
loggerOutput: debugPrint,
);
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => TalkerScreen(talker: talker),
)
);
TalkerScreen usage example
TalkerWrapper #
In addition to the above,
talker_flutter is able to show default and custom error messages and another status messages
final talker = Talker(
loggerOutput: debugPrint,
);
TalkerWrapper(
talker: talker,
options: const TalkerWrapperOptions(
enableErrorAlerts: true,
),
child: /// Application or the screen where you need to show messages
),
In order to understand in more details - you can check this article "Showing Flutter custom error messages"
TalkerWrapper usage example
See full application example with BLoC and navigation here
The talker_flutter package have a lot of another widgets like TalkerBuilder, TalkerListener, etc. You can find all of them in code documentation.
Features list #
✅ Logging
-
✅ Filtering
-
✅ Formatting
-
✅ Color logs
-
✅ LogLevels (info, verbose, warning, debug, error, critical, fine, good)
-
✅ Customization for filtering, formatting and colors
-
🚧 Separation from system's and another flutter logs
-
🚧 Collapsible feature for huge logs
-
🚧 Logs grouping
✅ Errors handling
- ✅ Errors and Exceptions identification
- ✅ StackTrace
- 🚧 Error level identification
✅ Flutter
-
✅ Application logs sharing
-
✅ Logs history list screen
-
✅ HTTP cals logging
-
✅ TalkerRouteObserver - router logging (which screen is opened, which is closed)
-
✅ TalkerWrapper - Showing errors and exceptions messages at UI
-
✅ TalkerListener - Listen logs data at application UI
-
✅ TalkerBuilder - UI builder to Logs List showing custom UI
-
✅ Android/Windows/Web application logs colors
-
🚧 iOS/MacOS application logs colors
✅ Logs and errors history saving
✅ TalkerObserver - handle all logs, errors, exceptions for integrations (Sentry, Crashlytics)
Coverage #
Error handling is a very important task
You need to choose carefully if you want to use a package for exceptions handling solution
Therefore, the project is 100% covered by tests
Additional information #
The project is under development and ready for your pull-requests and issues 👍
Thank you for support ❤️
For help getting started with 😍 Flutter, view online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.