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


Python Logging.info方法代码示例

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


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

示例1: create

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import info [as 别名]
	def create(self):
		Logging.info("Creating the network ...")
		conn = libvirt.open(DC.get("virsh", "connect"))
		configFile = file(self.config, "r")
		#print configFile.read()
		self.network = conn.networkDefineXML(configFile.read())
		self.network.setAutostart(1)
		self.network.create()
		
		return
开发者ID:jaxxer,项目名称:aivm,代码行数:12,代码来源:Network.py

示例2: check

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import info [as 别名]
	def check(self):
		network = self.parseName()
		
		Logging.info("Checking network '%s'..." % network)
		
		conn = libvirt.open(DC.get("virsh", "connect"))
		networks = conn.listNetworks()
		
		if not network in networks:
			return True
		
		return False
开发者ID:jaxxer,项目名称:aivm,代码行数:14,代码来源:Network.py

示例3: getNetwork

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import info [as 别名]
	def getNetwork(self):
		self.stdin.write("\n")
		
		stdoutRead = open(self.stdout.name)
		stdoutRead.seek(0, os.SEEK_END)
		
		Logging.info("Getting network settings...")
		
		command = self.config.get("commands", "get")
		self.stdin.write("%s\necho ==GET-NETWORK-DONE==\n\n" % command)
		
		addresses = ""
		i = 0
		while not "\n==GET-NETWORK-DONE==" in addresses:
			addresses += stdoutRead.read()
			
			if i > 50:
				raise NetworkSetterError("Error occured while getting network settings from guest '%s'." % self.guest.getHostName())
			
			i += 1
			time.sleep(1)
		
		
		Logging.debug("Raw network settings: %s" % str(addresses))
		
		inets = re.findall("inet6?\s+([a-f0-9:./]+)", addresses)
		
		ipAddresses = map(lambda inet: inet.split("/"), inets)
		ipAddresses = filter(lambda ip: not ip[0].startswith("fe80"), ipAddresses)
		
		Logging.debug("Processed network settings: %s" % str(ipAddresses))
		
		ipDict = {}
		
		for ip in ipAddresses:
			ipDict[ip[0]] = self.guest.getHostName()
		
		time.sleep(2)
		stdoutRead.close()
		
		return ipDict
开发者ID:jaxxer,项目名称:aivm,代码行数:43,代码来源:Network.py

示例4: setNetwork

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import info [as 别名]
	def setNetwork(self):
		self.stdin.write("\n")
		
		stdoutRead = open(self.stdout.name)
		stdoutRead.seek(0, os.SEEK_END)
		
		Logging.info("Trying set network...")
		
		settings = self.prepareData()
		commands = self.config.get("commands", "set", False, { "settings": settings })
		
		Logging.debug("Commands to write:\n%s" % str(commands))
		
		singleCommands = commands.split("\n")
		
		for cmd in singleCommands:
			self.stdin.write("%s\n" % cmd)
			time.sleep(0.1)
		
		self.stdin.write("\necho ==SET-NETWORK-DONE==\n\n")
		
		time.sleep(1)
		
		output = ""
		i = 0
		while not "\n==SET-NETWORK-DONE==" in output:
			output += stdoutRead.read()
			
			if i > 50:
				raise NetworkSetterError("Error occured while setting network settings from guest '%s'." % self.guest.getHostName())
			
			i += 1
			time.sleep(1)
		
		time.sleep(1)
		
		stdoutRead.close()
开发者ID:jaxxer,项目名称:aivm,代码行数:39,代码来源:Network.py

示例5: install

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import info [as 别名]
	def install(self, handler=DefaultHandler):
		self.setValues()
		destroy = None
		servers = self.startHttpd()
		
		master, slave = pty.openpty()
		
		stdin = os.fdopen(master, "w")
		
		logPath = self.log % self.values
		Logging.debug("Trying write install log of VM '%s' to %s."
										% (self.guest.getHostName(), logPath))
		stdout = open(logPath, "w")
		
		try:
			self.cmdInstall = self.cmdInstall.replace("\n", " ")
			
			Logging.info("Trying install guest '%s'..." % self.guest.getHostName())
			Logging.debug(self.cmdInstall % self.values)
			
			process = subprocess.Popen(self.cmdInstall % self.values, shell=True,
										stdin=slave, stdout=stdout, stderr=stdout,
										close_fds=True)
			
			analyzator = handler(stdin, stdout, process)
			analyzator.handle()
		except InstallationError as e:
			destroy = subprocess.Popen(self.cmdDestroy % self.values, shell=True)
			Logging.info("Check installation log for details: %s" % logPath)
			raise e
		finally:
			if servers[0]: servers[0].kill()
			if servers[1]: servers[1].kill()
		
		if destroy:
			return not destroy.wait()
		
		Logging.info("Guest '%s' installed." % self.guest.getHostName())
		
		return
开发者ID:jaxxer,项目名称:aivm,代码行数:42,代码来源:VirtInstall.py


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