Eliot 0.5.0: Structured Logging as Storytelling
Itamar Turner-Trauring
itamar at clusterhq.com
Wed Oct 22 17:25:44 CEST 2014
Eliot provides a structured logging and tracing system for Python that
generates log messages describing a forest of nested actions. Actions start
and eventually finish, successfully or not. Log messages thus tell a story:
what happened and what caused it.
Eliot is released by ClusterHQ <https://docs.clusterhq.com>, the Data
People for Docker™, and is available at https://pypi.python.org/pypi/eliot.
Here's what your logs might look like before using Eliot:
Going to validate http://example.com/index.html.
Started download attempted.
Download succeeded!
Missing <title> element in "/html/body".
Bad HTML entity in "/html/body/p[2]".
2 validation errors found!
After switching to Eliot you'll get a tree of messages with both message
contents and causal relationships encoded in a structured format:
- {"action_type": "validate_page", "action_status": "started", "url": "
http://example.com/index.html"}
- {"action_type": "download", "action_status": "started"}
- {"action_type": "download", "action_status": "succeeded"}
- {"action_type": "validate_html", "action_status": "started"}
- {"message_type": "validation_error", "error_type":
"missing_title", "xpath": "/html/head"}
- {"message_type": "validation_error", "error_type": "bad_entity",
"xpath": "/html/body/p[2]"}
- {"action_type": "validate_html", "action_status": "failed",
"exception": "validator.ValidationFailed"}
- {"action_type": "validate_page", "action_status": "failed",
"exception": "validator.ValidationFailed"}
What's New in 0.5.0:
- Added support for Python 3.4.
- Most public methods and functions now have underscore-based
equivalents to the camel case versions, e.g. eliot.write_traceback and
eliot.writeTraceback, for use in PEP 8 styled programs. Twisted-facing
APIs and pyunit assertions do not provide these additional APIs, as
camel-case is the native idiom.
- eliot.to_file outputs log messages to a file.
- Documented how to load Eliot logging into ElasticSearch via Logstash.
- Documentation has been significantly reorganized.
More information about the Python-announce-list
mailing list