我在我的项目中使用了一个开源的Python库。该库使用日志记录类记录大量信息。 ...但我看不到输出或将其记录到文件。我知道我将不得不创建一个记录器实例,并添加一个文件处理程序或控制台处理程序,但我怎样才能将这个记录器实例传递给该类?这里是我将要使用的类的init片段。将记录器实例传递给类
class Periscope:
''' Main Periscope class'''
def __init__(self):
self.config = ConfigParser.SafeConfigParser({"lang": "en"})
if is_local:
self.config_file = os.path.join(bd.xdg_config_home, "periscope", "config")
if not os.path.exists(self.config_file):
folder = os.path.dirname(self.config_file)
if not os.path.exists(folder):
logging.info("Creating folder %s" %folder)
os.mkdir(folder)
logging.info("Creating config file")
configfile = open(self.config_file, "w")
self.config.write(configfile)
configfile.close()
else:
#Load it
self.config.read(self.config_file)
self.pluginNames = self.listExistingPlugins()
self._preferedLanguages = None
任何帮助吗?
谢谢你们。