On 10/4/19 4:30 PM, Ian Pilcher wrote:
Ideally, I would pass my existing Logging.logger object into my C
function and use PyObject_CallMethod to call the appropriate method on
it (info, debug, etc.).

As I've researched this further, I've realized that this isn't the
correct approach.

My extension should be doing the C equivalent of:

    logger = logging.getLogger(__name__)

This is straightforward, except that I cannot figure out how to retrieve
the __name__.  I can get it from the module object with
PyModule_GetName, but that requires that I have a reference to the
module object in order to do so.

I would have thought that this would be easy for a module function to
access, but I haven't been able to find any API which does this.
(Module functions get NULL as their 'self' argument.)

Any pointers appreciated.  Thanks!

--
========================================================================
Ian Pilcher                                         arequip...@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to