当前位置: 首页>>代码示例>>Python>>正文


Python Logutil.log方法代码示例

本文整理汇总了Python中util.Logutil.log方法的典型用法代码示例。如果您正苦于以下问题:Python Logutil.log方法的具体用法?Python Logutil.log怎么用?Python Logutil.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Logutil的用法示例。


在下文中一共展示了Logutil.log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scanDescription

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import log [as 别名]
	def scanDescription(self, descFile, descParseInstruction, encoding):		
		
		Logutil.log('scanDescription: %s' % descFile, util.LOG_LEVEL_INFO)
		
		if(descFile.startswith('http://')):
			req = urllib2.Request(descFile)
			req.add_unredirected_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31')
			descFile = urllib2.urlopen(req).read()
		else:
			fh = open(str(descFile), 'r')
			descFile = fh.read()
		
		#load xmlDoc as elementtree to check with xpaths
		tree = fromstring(descFile)
		
		
		#single result as dictionary
		result = {}
					
		rootElement = self.grammarNode.attrib.get('root')		
				
		for node in tree.findall(rootElement):
			result = self.parseElement(node)
			result = self.replaceResultTokens(result)
			yield result
开发者ID:roeiba,项目名称:xbmc,代码行数:27,代码来源:descriptionparserxml.py

示例2: parseDescription

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import log [as 别名]
	def parseDescription(self, descFile, encoding):
		Logutil.log('parseDescription: %s' % descFile, util.LOG_LEVEL_INFO)
		
		results = None
						
		if(descFile.startswith('http://')):
			req = urllib2.Request(descFile)
			req.add_unredirected_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31')
			descFile = urllib2.urlopen(req).read()
			del req
		else:
			fh = open(str(descFile), 'r')
			descFile = fh.read()
			del fh
				
		#load xmlDoc as elementtree to check with xpaths
		# force utf-8
		parser = XMLParser(encoding='utf-8')
		tree = fromstring(descFile, parser)
		del descFile
		if(tree == None):
			return None				
						
		rootElementXPath = self.grammarNode.attrib.get('root')
		if(not rootElementXPath):
			rootElementXPath = "."
		rootElements = tree.findall(rootElementXPath)
		del tree, rootElementXPath
		if(rootElements == None):
			return None
		
		resultList = []
		
		for rootElement in rootElements:			
			tempResults = self.parseElement(rootElement)			
			if tempResults != None:				
				results = tempResults
				del tempResults
				results = self.replaceResultTokens(results)
				resultList.append(results)
		
		return resultList
开发者ID:martyn-harris,项目名称:romcollectionbrowser,代码行数:44,代码来源:descriptionparserxml.py

示例3: scanDescription

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import log [as 别名]
	def scanDescription(self, descFile, descParseInstruction, encoding):		
		
		Logutil.log('scanDescription: %s' % descFile, util.LOG_LEVEL_INFO)
		
		if(descFile.startswith('http://')):
			descFile = urllib.urlopen(descFile).read()
		else:
			fh = open(str(descFile), 'r')
			descFile = fh.read()
		
		#load xmlDoc as elementtree to check with xpaths
		tree = fromstring(descFile)
		
		
		#single result as dictionary
		result = {}
					
		rootElement = self.grammarNode.attrib.get('root')		
				
		for node in tree.findall(rootElement):
			result = self.parseElement(node)
			result = self.replaceResultTokens(result)
			yield result
开发者ID:070499,项目名称:repo-scripts,代码行数:25,代码来源:descriptionparserxml.py


注:本文中的util.Logutil.log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。