feat: enhance logging in AIAgent for quiet mode
- Added functionality to suppress logging noise from specific modules when in quiet mode, improving user experience in CLI. - Updated terminal_tool.py to change the log level for fallback directory usage from warning to debug, providing clearer context without cluttering logs.
This commit is contained in:
parent
5c2926102b
commit
8f6788474b
2 changed files with 15 additions and 2 deletions
13
run_agent.py
13
run_agent.py
|
|
@ -1207,6 +1207,19 @@ class AIAgent:
|
||||||
logging.getLogger('openai._base_client').setLevel(logging.ERROR)
|
logging.getLogger('openai._base_client').setLevel(logging.ERROR)
|
||||||
logging.getLogger('httpx').setLevel(logging.ERROR)
|
logging.getLogger('httpx').setLevel(logging.ERROR)
|
||||||
logging.getLogger('httpcore').setLevel(logging.ERROR)
|
logging.getLogger('httpcore').setLevel(logging.ERROR)
|
||||||
|
if self.quiet_mode:
|
||||||
|
# In quiet mode (CLI default), suppress all tool/infra log
|
||||||
|
# noise. The TUI has its own rich display for status; logger
|
||||||
|
# INFO/WARNING messages just clutter it.
|
||||||
|
for quiet_logger in [
|
||||||
|
'tools', # all tools.* (terminal, browser, web, file, etc.)
|
||||||
|
'minisweagent', # mini-swe-agent execution backend
|
||||||
|
'run_agent', # agent runner internals
|
||||||
|
'trajectory_compressor',
|
||||||
|
'cron', # scheduler (only relevant in daemon mode)
|
||||||
|
'hermes_cli', # CLI helpers
|
||||||
|
]:
|
||||||
|
logging.getLogger(quiet_logger).setLevel(logging.ERROR)
|
||||||
|
|
||||||
# Initialize OpenAI client - defaults to OpenRouter
|
# Initialize OpenAI client - defaults to OpenRouter
|
||||||
client_kwargs = {}
|
client_kwargs = {}
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ def _get_scratch_dir() -> Path:
|
||||||
logger.info("Using /scratch for sandboxes: %s", user_scratch)
|
logger.info("Using /scratch for sandboxes: %s", user_scratch)
|
||||||
return user_scratch
|
return user_scratch
|
||||||
|
|
||||||
# Fall back to /tmp
|
# Fall back to /tmp (only relevant for Singularity/HPC sandboxes)
|
||||||
logger.warning("/scratch not available, using /tmp (limited space)")
|
logger.debug("/scratch not available, using /tmp for sandboxes")
|
||||||
return Path(tempfile.gettempdir())
|
return Path(tempfile.gettempdir())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue