itamarst / eliot

Eliot: the logging system that tells you *why* it happened
https://eliot.readthedocs.io
Apache License 2.0
1.09k stars 65 forks source link

Is there a no-op version of eliot #488

Closed rouilj closed 2 years ago

rouilj commented 2 years ago

Hello:

I maintain the Roundup Issue Tracker. Eliot looks like a useful tool for adding context to logging in development or production. But I don't want to require all my users to install Eliot just to run Roundup.

Is there a replacement that I can use if

  import eliot 

fails that will provide no-ops (mocks) for the eliot methods.

Roundup runs under both python 2.7 as well as 3.6+. In order to use newer eliot features under python3, I would need this mock library for Python 2.7.

Thanks.

-- rouilj

itamarst commented 2 years ago

Hi, I don't really have the time to maintain that unfortunately.

However: for a while Tahoe-LAFS, which uses Eliot, was supporting both Python 2 and Python 3 (in fact the code mostly still does) and we successfully had both working, with a few strategic if statements. I think most of the issues were that Eliot doesn't automatically do Unicode conversion for bytes on Python 3... but Python 3 version of Eliot also has the custom JSON encoder support, so that's how we solved it.

See https://github.com/tahoe-lafs/tahoe-lafs/blob/tahoe-lafs-1.17.1/src/allmydata/util/_eliot_updates.py, the eliot_json_encoder.

rouilj commented 2 years ago

Thanks for the reply.

I'll check out the lafs changes.