Implement DefaultLogger in log/default_logger.go.
- It needs to implement the Logger interface.
- We should use RWMutex to ensure the enable switch is thread-safe. Don't use complex channels.
- For logic, OnBeforeEvent records start time. OnAfterEvent calcs duration, formats LogEntry to map, and prints as JSON string.
- It should support subscription filtering.
- Returning nil simply means log all events.
Tests:
Create log/default_logger_test.go. Verify the enabling switch and filter logic. Check if the output is valid JSON with expected fields. Ensure high test coverage and handle edge cases like nil pointers.
Implement DefaultLogger in log/default_logger.go.
Tests:
Create log/default_logger_test.go. Verify the enabling switch and filter logic. Check if the output is valid JSON with expected fields. Ensure high test coverage and handle edge cases like nil pointers.