https://github.com/leancodepl/logging_bugfender
A library helping integrate Bugfender with the logging package.
https://github.com/leancodepl/logging_bugfender
bugfender flutter logging
Last synced: about 2 months ago
JSON representation
A library helping integrate Bugfender with the logging package.
- Host: GitHub
- URL: https://github.com/leancodepl/logging_bugfender
- Owner: leancodepl
- License: apache-2.0
- Created: 2020-12-16T12:18:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T09:59:29.000Z (7 months ago)
- Last Synced: 2025-03-25T19:16:07.363Z (3 months ago)
- Topics: bugfender, flutter, logging
- Language: Dart
- Homepage: https://pub.dev/packages/logging_bugfender
- Size: 53.7 KB
- Stars: 2
- Watchers: 7
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# logging_bugfender
[![logging_bugfender pub.dev badge][pub-badge]][pub-badge-link]
[![][build-badge]][build-badge-link]A library helping integrate Bugfender with the [logging] package.
## Usage
### Setup
```dart
final loggingListener = LoggingBugfenderListener('my-very-secret-app-key');void main() {
setupLogger(true);
// ...
runApp(MyApp());
}void setupLogger(bool debugMode) {
if (debugMode) {
// During debugging, you'll usually want to log everything
Logger.root.level = Level.ALL;
LoggingBugfenderListener(
config.bugfenderKey,
consolePrintStrategy: const PlainTextPrintStrategy(),
).listen(Logger.root);
} else {
// On production, you probably want to log only INFO and above
Logger.root.level = Level.INFO;
LoggingBugfenderListener(config.bugfenderKey).listen(Logger.root);
}
}
```### Custom data
You can also add and remove custom data.
```dart
const logUsernameKey = 'username';// After the user signs in
loggingListener.setCustomData(logUsernameKey, '');// After the user signs out
loggingListener.removeCustomData(logUsernameKey);
```### In a cubit
```dart
class FooBarCubit {
final _logger = Logger('FooBarCubit');// (...)
void doSomething() {
try {
// (...)
_logger.info('Successfuly did something');
} catch (err, st) {
_logger.severe('Failed doing something', err, st);
}
}
}
```[pub-badge]: https://img.shields.io/pub/v/logging_bugfender
[pub-badge-link]: https://pub.dev/packages/logging_bugfender
[build-badge]: https://img.shields.io/github/actions/workflow/status/leancodepl/logging_bugfender/test.yml?branch=master
[build-badge-link]: https://github.com/leancodepl/logging_bugfender/actions/workflows/test.yml
[logging]: https://pub.dev/packages/logging