Logger (model.game.logger)¶
model.game.logger
¶
Game logging system recording played moves to in-memory history and log files.
GameLogger
¶
Logs chess moves to memory and optionally writes them to a persistent file.
Source code in src/model/game/logger.py
file_path
property
¶
Path to the underlying log file, if any.
__init__(filename=None)
¶
Initialize a GameLogger instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
Optional[str]
|
Optional filesystem path for appending move logs. |
None
|
Source code in src/model/game/logger.py
create_file(filename)
¶
Create or overwrite a log file with an initial header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Target file path. |
required |
Source code in src/model/game/logger.py
get_moves()
¶
Get copy of all recorded moves.
Returns:
| Type | Description |
|---|---|
List[Any]
|
List of recorded Move instances or strings. |
log_move(move)
¶
Record a played move in memory and append to file if configured.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move
|
Any
|
Move object or string representation. |
required |