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

Use Eliot to generate stdlib log messages? #489

Open gwerbin opened 1 year ago

gwerbin commented 1 year ago

Consider the use case of an established web application, which has a nontrivial logging setup involving correlation IDs, integration with some observability platform like Datadog, etc. Migrating such an application to Eliot's entirely separate logging framework would be a tough sell at best, and generally would not be a pragmatic engineering decision, even if Eliot supports a relatively smooth migration path by installing its own handler for stdlib logging.

However, the promise of Eliot's "context-based" and "causal" logging is very enticing. Is there any way that Eliot could be set up to generate logging log entries? One could imagine that Eliot could "install" itself in the form of a logging.Filter that attaches its various metadata items to each log record. Is this something that Eliot can do now, or something that it might be able to do one day?

MartinBernstorff commented 2 months ago

I think this is incredibly interesting as well!

It would also allow Eliot to be added to library code instead of logging calls. One could imagine it would add "flat" logging info if captured by a logging log, and "causal"/"traced" information if captured by an eliot log.

@itamarst Hope it's OK with a ping here! I tried running through the documentation and code, but didn't find anything on this use case. Did I miss anything? :-)