
The project I am working on uses pymodbus which I am sure shares a fairly common attribute with many other modules of using Python's standard Logging mechanism - a very reasonable choice even for a module that supports Twisted, the library can also be used entirely synchronously and thus would not want a required dependency of Twisted. It struck me that it would be great to be able to redirect the standard logging library to use twisted.logger by some sort of 'Clever Monkey Patching' and that this may be a relatively common requirement... however after extensive searching, and asking on the pymodbus list, I can't find any evidence that such a thing has ever been attempted or discussed. The reverse mechanism of sending twisted.logger's output to the standard library is of course handled by the twisted.logger.STDLibLogObserver (and similar in twisted legacy logging) but the documentation for this even suggests why this is a bad idea: 'Warning: specific logging configurations (example: network) can lead to this observer blocking.' which seems to me why it would be better to attempt this the other way around... Am I crazy to even think this? is it just the rambling of Python/Twisted newb? Or is there something I'm missing that would make this impossible to do generically, and awkward to provide a vague recipe of how to do? I do appreciate that twisted.logger offers a more feature rich (structured) API and the Logging API would only be able to provide level and text but it would be better than loosing any possibly useful log messages from used modules in my mind. If anyone can enlighten me I would be most appreciative, Cheers /dan -- Daniel Sutcliffe <dansut@gmail.com>