mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
fix openhands cli loglevel (#9382)
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
parent
3f5a5005a2
commit
ea07570f62
@ -364,7 +364,16 @@ async def main_with_loop(loop: asyncio.AbstractEventLoop) -> None:
|
||||
"""Runs the agent in CLI mode."""
|
||||
args = parse_arguments()
|
||||
|
||||
logger.setLevel(logging.WARNING)
|
||||
# Set log level from command line argument if provided
|
||||
if args.log_level and isinstance(args.log_level, str):
|
||||
log_level = getattr(logging, str(args.log_level).upper())
|
||||
logger.setLevel(log_level)
|
||||
else:
|
||||
# Set default log level to WARNING if no LOG_LEVEL environment variable is set
|
||||
# (command line argument takes precedence over environment variable)
|
||||
env_log_level = os.getenv('LOG_LEVEL')
|
||||
if not env_log_level:
|
||||
logger.setLevel(logging.WARNING)
|
||||
|
||||
# Load config from toml and override with command line arguments
|
||||
config: OpenHandsConfig = setup_config_from_args(args)
|
||||
|
||||
@ -790,6 +790,7 @@ async def test_config_loading_order(
|
||||
mock_args.llm_config = None # This should allow settings to be used
|
||||
# Add a file property to avoid file I/O errors
|
||||
mock_args.file = None
|
||||
mock_args.log_level = 'INFO'
|
||||
mock_parse_args.return_value = mock_args
|
||||
|
||||
# Mock read_task to return a dummy task
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user