[Twisted-Python] Persuading Python's Logging to use twisted.logger
Glyph
glyph at twistedmatrix.com
Tue May 24 18:05:41 MDT 2016
> On May 24, 2016, at 4:10 PM, Daniel Sutcliffe <dansut at gmail.com> wrote:
>
>> The main reason I wanted to do the format-string translation is that it would allow the key/value pairs to be stored according to the same idiom that Twisted uses, and therefore be serialized to jsonFileLogObserver and consequently things like LogStash / ElasticSearch.
>
> I kept the format-string args within a dictionary under the args kwarg
> to emit() for exactly the reasons you gave above but felt that
> translating a %-encoded string into the new-style that twisted.logger
> uses was likely to make the example much more complicated, and was
> frankly beyond my limited needs. There's probably a simple way to do
> this in Python that I am not aware of yet though...
I wrote a function to do this some time ago, and I forget the exact derivation, but somehow it ended up here:
https://github.com/moreati/formatist
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20160524/9d3a0cb2/attachment-0002.html>
More information about the Twisted-Python
mailing list