Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

tweak logging line lengths

Nick Sweetinge9769ac18ecc
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 1c9ba9653..df0f8e8b2 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1576,12 +1576,12 @@ class Agent(Generic[Context, AgentStructuredOutput]):
# Get action name from the action model
action_data = action.model_dump(exclude_unset=True)
action_name = next(iter(action_data.keys())) if action_data else 'unknown'
- action_params = getattr(action, action_name, '') or str(action.model_dump(mode='json'))[:40].replace(
+ action_params = getattr(action, action_name, '') or str(action.model_dump(mode='json'))[:56].replace(
'"', ''
).replace('{', '').replace('}', '').replace("'", '').strip().strip(',')
# Ensure action_params is always a string before checking length
action_params = str(action_params)
- action_params = f'{action_params[:20]}...' if len(action_params) > 24 else action_params
+ action_params = f'{action_params[:50]}...' if len(action_params) > 54 else action_params
time_start = time.time()
self.logger.info(f'🦾 Executing action {i + 1}/{total_actions}: {cyan}{action_name}({action_params}){reset}...')
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 1965ff771..4a09d0cae 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -672,8 +672,8 @@ class BrowserSession(BaseModel):
f'[get_or_create_cdp_session] Switching agent focus from {self.agent_focus.target_id} to {target_id}'
)
self.agent_focus = session
- else:
- self.logger.debug(f'[get_or_create_cdp_session] Reusing existing session for {target_id} (focus={focus})')
+ # else:
+ # self.logger.debug(f'[get_or_create_cdp_session] Reusing existing session for {target_id} (focus={focus})')
return session
# If it's the current focus target, return that session