我正在编写 python 脚本,并且正在使用 python 日志记录模块将一些信息写入日志文件(请参阅http://docs.python.org/howto/logging.html)。
这是一个小例子(也来自提到的页面):
import logging
import logging.config
logging.config.fileConfig('logging.conf')
# create logger
logger = logging.getLogger('simpleExample')
# 'application' code
logger.info('info message')
logger.error('error message')
现在我想为 python 创建一个 c 扩展,我想在我的程序中导入它。
问题是:如何从我的 c 代码在我的日志文件中写入信息?有没有办法使用 python c 扩展中的日志记录模块?
感谢您的任何评论!