include page_url in new logging

This commit is contained in:
Barbara Miller 2025-02-06 16:15:00 -08:00
parent 61d64a1166
commit 4e82cf5bf5

View File

@ -584,7 +584,7 @@ class Browser:
behavior_script = brozzler.behavior_script( behavior_script = brozzler.behavior_script(
page_url, behavior_parameters, behaviors_dir=behaviors_dir page_url, behavior_parameters, behaviors_dir=behaviors_dir
) )
self.run_behavior(behavior_script, timeout=behavior_timeout) self.run_behavior(behavior_script, page_url, timeout=behavior_timeout)
final_page_url = self.url() final_page_url = self.url()
if on_screenshot: if on_screenshot:
if simpler404: if simpler404:
@ -779,7 +779,7 @@ class Browser:
message = self.websock_thread.pop_result(msg_id) message = self.websock_thread.pop_result(msg_id)
return message["result"]["result"]["value"] return message["result"]["result"]["value"]
def run_behavior(self, behavior_script, timeout=900): def run_behavior(self, behavior_script, page_url, timeout=900):
self.send_to_chrome( self.send_to_chrome(
method="Runtime.evaluate", method="Runtime.evaluate",
suppress_logging=True, suppress_logging=True,
@ -795,10 +795,12 @@ class Browser:
if elapsed > timeout: if elapsed > timeout:
logging.info( logging.info(
"behavior reached hard timeout after %.1fs and %s valid checks, " "behavior reached hard timeout after %.1fs and %s valid checks, "
"and %s invalid checks", "and %s invalid checks, "
"for url %s",
elapsed, elapsed,
valid_behavior_checks, valid_behavior_checks,
invalid_behavior_checks, invalid_behavior_checks,
page_url
) )
return return
@ -842,10 +844,11 @@ class Browser:
elapsed = time.time() - start elapsed = time.time() - start
self.logger.info( self.logger.info(
"behavior decided it has finished after %.1fs and %s valid checks, " "behavior decided it has finished after %.1fs and %s valid checks, "
"and %s invalid checks", "and %s invalid checks, for url %s",
elapsed, elapsed,
valid_behavior_checks, valid_behavior_checks,
invalid_behavior_checks, invalid_behavior_checks,
page_url
) )
return return
invalid_behavior_checks += 1 invalid_behavior_checks += 1