https://github.com/dotupnet/dotup_flutter_logger_sqflite
https://github.com/dotupnet/dotup_flutter_logger_sqflite
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dotupnet/dotup_flutter_logger_sqflite
- Owner: dotupNET
- License: gpl-3.0
- Created: 2021-09-13T07:49:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T09:53:09.000Z (almost 2 years ago)
- Last Synced: 2025-07-28T23:04:50.344Z (6 months ago)
- Language: Dart
- Size: 195 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# dotup_flutter_logger_sqflite
## Take a look at [dotup.de](https://dotup.de) or on [pub.dev](https://pub.dev/packages?q=dotup)
## Example
```dart
Future example() async {
var dir = await getApplicationDocumentsDirectory();
final dbFolder = dir.path;
if (!await Directory(dbFolder).exists()) {
await Directory(dbFolder).create(recursive: true);
}
final databaseFile = '$dbFolder/logging.db';
// Initialize log writer
final sqfLiteLogWriter = SqfLiteLogWriter(LogLevel.All);
await sqfLiteLogWriter.initialize(databaseFile);
// Add to logger manager
LoggerManager.addLogWriter(sqfLiteLogWriter);
runApp(MyApp());
// Use it everywhere
final logger = Logger('Nice');
logger.warn('Oh');
logger.info('Ah');
// Get all entries from database
final repo = sqfLiteLogWriter.repository;
final all = await repo.readAll();
for (var item in all) {
print(item.message);
}
}
```