add logging
This commit is contained in:
@@ -21,6 +21,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Match-3 debug controls include gem count adjustment and board reroll
|
||||
- Difficulty presets: Easy (3 gems), Normal (5 gems), Hard (8 gems)
|
||||
- Gameplay mode switching: Space+Enter in game scene switches between match-3 and clickomania modes
|
||||
- Test scripts located in `tests/` directory for system validation
|
||||
- Use `test_logging.gd` to validate the logging system functionality
|
||||
|
||||
### Audio Configuration
|
||||
- Music: Located in `assets/audio/music/` directory with loop configuration in AudioManager
|
||||
@@ -51,11 +53,19 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Use F12 key for global debug toggle
|
||||
- Remove debug prints before committing unless permanently useful
|
||||
|
||||
### Logging System Usage
|
||||
- **ALWAYS** use `DebugManager` logging functions instead of `print()`, `push_error()`, etc.
|
||||
- Use appropriate log levels: INFO for general messages, WARN for issues, ERROR for failures
|
||||
- Include meaningful categories to organize log output: `"GameManager"`, `"Match3"`, `"Settings"`
|
||||
- Leverage structured logging for better debugging and production monitoring
|
||||
- Use `DebugManager.set_log_level()` to control verbosity during development and testing
|
||||
|
||||
## Important File References
|
||||
|
||||
### Documentation Structure
|
||||
- **`docs/MAP.md`** - Complete project architecture and structure
|
||||
- **`docs/CODE_OF_CONDUCT.md`** - Coding standards and best practices
|
||||
- **`docs/TESTING.md`** - Testing guidelines and conventions
|
||||
- **This file** - Claude Code specific development guidelines
|
||||
|
||||
### Key Scripts to Understand
|
||||
@@ -78,12 +88,27 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Test debug UI with F12 toggle
|
||||
- Verify scene transitions work correctly
|
||||
- Check mobile compatibility if UI changes made
|
||||
- Use relevant test scripts from `tests/` directory to validate system functionality
|
||||
- Run `test_logging.gd` after making changes to the logging system
|
||||
|
||||
### Common Implementation Patterns
|
||||
- Scene transitions: Use `GameManager.start_game_with_mode()` and related methods
|
||||
- Debug integration: Connect to `DebugManager` signals and initialize debug state
|
||||
- Logging: Use `DebugManager.log_*()` functions with appropriate levels and categories
|
||||
- Gameplay modes: Implement in `scenes/game/gameplays/` directory following modular pattern
|
||||
- Scoring system: Connect `score_changed` signal from gameplay to main game scene
|
||||
- Settings: Use `SettingsManager` for persistent configuration
|
||||
- Audio: Use `AudioManager` for music and sound effects
|
||||
- Localization: Use `LocalizationManager` for language switching
|
||||
- Localization: Use `LocalizationManager` for language switching
|
||||
|
||||
### Logging Best Practices
|
||||
```gdscript
|
||||
# ✅ Good logging practices
|
||||
DebugManager.log_info("Scene transition completed", "GameManager")
|
||||
DebugManager.log_warn("Settings file not found, using defaults", "Settings")
|
||||
DebugManager.log_error("Failed to load audio resource: " + audio_path, "AudioManager")
|
||||
|
||||
# ❌ Avoid these patterns
|
||||
print("debug") # Use structured logging instead
|
||||
push_error("error") # Use DebugManager.log_error() with category
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user