Using a logging.Logger in a C extension

Ian Pilcher arequipeno at gmail.com
Fri Oct 4 17:30:56 EDT 2019


I am working my way through writing a C extension, and I've realized
that I need to log a few messages from the C code.

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.).

PyArg_ParseTuple should be able to handle this with an "O!" format unit,
but I can't figure out how to retrieve the type object for
logging.Logger.

Any hints, links, etc. appreciated.

Thanks!

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




More information about the Python-list mailing list