mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
feat(logger): add extensible logging API, usage examples, and bilingual documentation
- Introduce CherryPickLogger interface, PrintLogger and SilentLogger implementations - Add setGlobalLogger() to CherryPick API for custom DI logging - Log key events (scope, module, error) via logger throughout DI lifecycle - Comprehensive comments and code documentation in both English and Russian - Document usage of logging system in quick_start and full_tutorial documentation (EN/RU) - Provide usage examples in docs and code comments - No logging inside GlobalCycleDetectionMixin (design choice: exceptions handled at Scope, not detector/mixin level) and detailed architectural reasoning - Update helper.dart, logger.dart: comments, examples, API doc improvements BREAKING CHANGE: Projects can now inject any logger via CherryPick.setGlobalLogger; default log behavior clarified and docstrings/usage examples enhanced
This commit is contained in:
@@ -358,6 +358,26 @@ class MyApp extends StatelessWidget {
|
||||
- Вы можете создавать подскоупы, если нужно, например, для экранов или модулей:
|
||||
`final subScope = CherryPickProvider.of(context).openSubScope(scopeName: "profileFeature");`
|
||||
|
||||
---
|
||||
|
||||
## Логирование
|
||||
|
||||
Чтобы включить вывод логов о событиях и ошибках DI в CherryPick, настройте глобальный логгер до создания любых scope:
|
||||
|
||||
```dart
|
||||
import 'package:cherrypick/cherrypick.dart';
|
||||
|
||||
void main() {
|
||||
// Установите глобальный логгер до создания scope
|
||||
CherryPick.setGlobalLogger(PrintLogger()); // или свой логгер
|
||||
final scope = CherryPick.openRootScope();
|
||||
// Логи DI и циклов будут выводиться через ваш логгер
|
||||
}
|
||||
```
|
||||
|
||||
- По умолчанию используется SilentLogger (нет логов в продакшене).
|
||||
- Любые ошибки резолва и события циклов логируются через info/error на логгере.
|
||||
|
||||
---
|
||||
## CherryPick подходит не только для Flutter!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user