feat: logs

This commit is contained in:
Enrico Bottazzi 2026-02-19 15:43:51 +01:00
parent cdacce31d2
commit 10132c32a6
5 changed files with 9 additions and 8 deletions

View file

@ -454,6 +454,8 @@ class BaseModelClient:
else:
# Load generic conversation instructions
instructions = load_prompt(get_prompt_path("conversation_instructions.txt"), prompts_dir=self.prompts_dir)
logger.debug(f"[{power_name}] Conversation instructions: {instructions}")
# KEEP ORIGINAL: Use build_context_prompt as before
context = build_context_prompt(
@ -468,6 +470,8 @@ class BaseModelClient:
prompts_dir=self.prompts_dir,
)
logger.debug(f"[{power_name}] Conversation context: {context}")
# KEEP ORIGINAL: Get recent messages targeting this power to prioritize responses
recent_messages_to_power = game_history.get_recent_messages_to_power(power_name, limit=3)

View file

@ -6,8 +6,8 @@ from typing import Dict, List, Optional
import re
logger = logging.getLogger("utils")
logger.setLevel(logging.INFO)
logging.basicConfig(level=logging.INFO)
# Level inherited from root (set in lm_game.py); use --debug for DEBUG globally.
load_dotenv()

View file

@ -13,8 +13,7 @@ if TYPE_CHECKING:
from diplomacy import Game
logger = logging.getLogger("negotiations")
logger.setLevel(logging.INFO)
logging.basicConfig(level=logging.INFO)
# Level inherited from root (set in lm_game.py); use --debug for DEBUG globally.
load_dotenv()

View file

@ -24,8 +24,7 @@ if TYPE_CHECKING:
# from .agent import DiplomacyAgent
logger = logging.getLogger("utils")
logger.setLevel(logging.INFO)
logging.basicConfig(level=logging.INFO)
# Level inherited from root (set in lm_game.py); use --debug for DEBUG globally.
load_dotenv()

View file

@ -205,8 +205,7 @@ async def main():
config.DEBUG = getattr(args, "debug", False)
if config.DEBUG:
logging.getLogger().setLevel(logging.DEBUG)
# debug_log_llm_io() in ai_diplomacy.utils uses logger.debug(); ensure that logger is not capped at INFO
logging.getLogger("utils").setLevel(logging.DEBUG)
# Named loggers (negotiations, utils, etc.) inherit root when they don't set their own level.
logger.info("Debug mode enabled: logger.debug() messages and every LLM input/output will be shown.")
logger.info(f"args.simple_prompts = {args.simple_prompts} (type: {type(args.simple_prompts)}), args.prompts_dir = {args.prompts_dir}")