Integrating and Migrating Existing Logging¶

If you have an existing code base, you likely have existing log messages. This document will explain how to migrate and integrate existing logging into your new Eliot log setup. In particular, this will focus on the Python standard library logging package, but the same principles apply to other logging libraries.

Route existing logs to Eliot¶ Eliot includes a logging.Handler that can take standard library log messages and route them into Eliot. These log messages will automatically appear in the correct place in the action tree! Once you add actions to your code these log messages will automatically benefit from Eliot’s causal information. To begin with, however, we’ll just add routing of log messages to Eliot: # Add Eliot Handler to root Logger. You may wish to only route specific # Loggers to Eliot. import logging from eliot.stdlib import EliotHandler logging . getLogger () . addHandler ( EliotHandler ())