<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div dir="ltr">Most logging systems can tell you what happened; Eliot tells you <em>why</em> it happened:<br />
<div class="gmail_quote">
<div dir="ltr">
<div>
<div><br /><span style="font-family: monospace,monospace;">$ python linkcheck.py | eliot-tree<br />4c42a789-76f5-4f0b-b154-3dd0e3041445<br />+-- check_links@1/started<br />    `-- urls: [u'http://google.com', u'http://nosuchurl']<br />    +-- download@2,1/started<br />        `-- url: http://google.com<br />        +-- download@2,2/succeeded<br />    +-- download@3,1/started<br />        `-- url: http://nosuchurl<br />        +-- download@3,2/failed<br />            |-- exception: requests.exceptions.ConnectionError<br />            |-- reason: ('Conn aborted', gaierror(-2, 'Name unknown'))<br />    +-- check_links@4/failed<br />        |-- exception: exceptions.ValueError<br />        |-- reason: ('Conn aborted.', gaierror(-2, 'Name unknown'))<br /></span></div>
And here's the code that generated these logs (<a href="https://warehouse.python.org/project/eliot-tree/">eliot-tree</a> was used to render the output):<br /><br /><span style="font-family: monospace,monospace;">import sys<br />from eliot import start_action, to_file<br />import requests<br />to_file(sys.stdout)<br /><br />def check_links(urls):<br />    with start_action(action_type="check_links", urls=urls):<br />        for url in urls:<br />            try:<br />                with start_action(action_type="download", url=url):<br />                    response = requests.get(url)<br />                    response.raise_for_status()<br />            except Exception as e:<br />                raise ValueError(str(e))<br /><br />check_links(["http://google.com"], ["http://nosuchurl"])<br /><br /><span style="font-family: arial,helvetica,sans-serif;"><br /></span></span></div>
<div><span style="font-family: arial,helvetica,sans-serif;">Interested? Read more at <a href="https://eliot.readthedocs.org/">https://eliot.readthedocs.org/</a>.<br /><br />Eliot is released under the Apache License 2 by <a href="https://clusterhq.com">ClusterHQ</a>, the Container Data People. <a href="https://clusterhq.com/careers/">We're hiring!</a><br /></span></div>
<span style="font-family: monospace,monospace;"></span></div>
</div>
</div>
</body></html>