當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。