mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +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:
16
cherrypick/test/mock_logger.dart
Normal file
16
cherrypick/test/mock_logger.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:cherrypick/cherrypick.dart';
|
||||
|
||||
class MockLogger implements CherryPickLogger {
|
||||
final List<String> infos = [];
|
||||
final List<String> warns = [];
|
||||
final List<String> errors = [];
|
||||
|
||||
@override
|
||||
void info(String message) => infos.add(message);
|
||||
@override
|
||||
void warn(String message) => warns.add(message);
|
||||
@override
|
||||
void error(String message, [Object? e, StackTrace? s]) =>
|
||||
errors.add(
|
||||
'$message${e != null ? ' $e' : ''}${s != null ? '\n$s' : ''}');
|
||||
}
|
||||
Reference in New Issue
Block a user