Stefan,

You have understood my question.  I'm new to Python.  Could I use a Cython 
solution to get suggestions on just how to go about this in the C extension?  
Otherwise could you suggest which C-API functions I should be looking at?

Thanks,
Al

-----Original Message-----
From: Stefan Behnel [mailto:stefan...@behnel.de] 
Sent: Wednesday, August 19, 2015 2:51 PM
Subject: Re: Logging to a file from a C-extension

Al Pfalzgraf schrieb am 18.08.2015 um 15:07:
> If a logging file is opened at the level of a Python application, how 
> would the log file name be communicated to a C-extension so that 
> logging from the extension would be sent to the same log file?

Writing to the file directly (as was suggested) may not be a good idea as it 
would bypass the log filtering and formatting. Instead, I'd suggest sending 
output to a normal Python Logger object instead.

This is obviously trivial in Cython (where you can just implement it in Python 
code), but you can do the same in C with just the usual C-API overhead.

Stefan


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

Reply via email to