wearpants / twiggy

Pythonic logger, shipped in Redhat & Debian
BSD 3-Clause "New" or "Revised" License
47 stars 11 forks source link

dict_config() support #59

Closed abadger closed 6 years ago

abadger commented 7 years ago

I've been meaning to try out twiggy since I saw your lightning talk on it at PyCon Atlanta. Finally got around to it this weekend and absolutely love it! It's the logging API that I've always wished the stdlib shipped with but never realized.

The only thing that logging had that I missed was being able to configure it via a dictionary (This was added in pyhton-2.7 so twiggy probably predates that addition). Configuring via a dictionary allows having a configuration file that the user can write to configure logging on their deployment system. So, over the weekend, I put together a quick, version of dict_config() that can take a dictionary and then call add_emitters() to configure twiggy:

https://github.com/abadger/stellarmagnate/blob/master/magnate/twiggy_addon.py#L107

Are you interested in seeing something like that implemented in twiggy? The current code is Python-3 only and makes use of the third-party voluptuous library for validating the dictionary passed in but if you're interested in it, I could take the time to port it to dual Python2/Python3 code and make it validate its schema without the use of voluptuous. I could also enhance the schema if there are things you notice that twiggy can do but the schema cannot express.

Let me know if I should do that work or not.

abadger commented 7 years ago

Working on adding this here: https://github.com/abadger/twiggy/tree/add-dict_config