summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crocoite/behavior.py4
-rw-r--r--crocoite/cli.py9
-rw-r--r--crocoite/controller.py12
3 files changed, 23 insertions, 2 deletions
diff --git a/crocoite/behavior.py b/crocoite/behavior.py
index 2d1dd0d..02fe2ea 100644
--- a/crocoite/behavior.py
+++ b/crocoite/behavior.py
@@ -198,10 +198,14 @@ class EmulateScreenMetrics (Behavior):
l = self.loader
tab = l.tab
for s in sizes:
+ self.logger.debug ('device override',
+ uuid='3d2d8096-1a75-4830-ad79-ae5f6f97071d', **s)
await tab.Emulation.setDeviceMetricsOverride (**s)
# give the browser time to re-eval page and start requests
# XXX: should wait until loader is not busy any more
await asyncio.sleep (1)
+ self.logger.debug ('clear override',
+ uuid='f9401683-eb3a-4b86-9bb2-c8c5d876fc8d')
await tab.Emulation.clearDeviceMetricsOverride ()
return
yield # pragma: no cover
diff --git a/crocoite/cli.py b/crocoite/cli.py
index 1f22c45..0595eb9 100644
--- a/crocoite/cli.py
+++ b/crocoite/cli.py
@@ -23,6 +23,7 @@ Command line interface
"""
import argparse, sys, signal, asyncio, os
+from traceback import TracebackException
from enum import IntEnum
from yarl import URL
try:
@@ -86,6 +87,14 @@ def single ():
ret = SingleExitStatus.Ok
except Crashed:
ret = SingleExitStatus.BrowserCrash
+ except asyncio.CancelledError:
+ # don’t log this one
+ pass
+ except Exception as e:
+ ret = SingleExitStatus.Fail
+ logger.error ('cli exception',
+ uuid='7fd69858-ecaa-4225-b213-8ab880aa3cc5',
+ traceback=list (TracebackException.from_exception (e).format ()))
finally:
r = handler[0].stats
logger.info ('stats', context='cli', uuid='24d92d16-770e-4088-b769-4020e127a7ff', **r)
diff --git a/crocoite/controller.py b/crocoite/controller.py
index 788a131..772bf44 100644
--- a/crocoite/controller.py
+++ b/crocoite/controller.py
@@ -22,8 +22,7 @@
Controller classes, handling actions required for archival
"""
-import time
-import tempfile, asyncio, json, os
+import time, tempfile, asyncio, json, os
from itertools import islice
from datetime import datetime
from operator import attrgetter
@@ -176,23 +175,32 @@ class SinglePageController:
if not finished:
# idle timeout
+ logger.debug ('idle timeout',
+ uuid='90702590-94c4-44ef-9b37-02a16de444c3')
idleProc.cancel ()
timeoutProc.cancel ()
break
elif handle in finished:
# something went wrong while processing the data
+ logger.error ('fetch failed',
+ uuid='43a0686a-a3a9-4214-9acd-43f6976f8ff3')
idleProc.cancel ()
timeoutProc.cancel ()
handle.result ()
assert False # previous line should always raise Exception
elif timeoutProc in finished:
# global timeout
+ logger.debug ('global timeout',
+ uuid='2f858adc-9448-4ace-94b4-7cd1484c0728')
idleProc.cancel ()
timeoutProc.result ()
break
elif idleProc in finished:
# idle state change
isIdle = idleProc.result ()
+ logger.debug ('idle state',
+ uuid='e3eaff79-7b56-4d17-aa42-d32fa1ec268b',
+ idle=isIdle)
if isIdle:
# browser is idle, start the clock
idleTimeout = self.settings.idleTimeout