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


Python LOG.debug方法代码示例

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


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

示例1: run

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def run(self):
     L.info("Command Send : %s" % self.command)
     args = self.command.split(" ")
     subproc_args = { 'stdin'        : subprocess.PIPE,
                      'stdout'       : subprocess.PIPE,
                      'stderr'       : subprocess.STDOUT,
     }
     try:
         proc = subprocess.Popen(args, **subproc_args)
     except OSError:
         L.info("Failed to execute command: %s" % args[0])
         sys.exit(1)
     (stdouterr, stdin) = (proc.stdout, proc.stdin)
     Li = []
     result = None
     if stdouterr is None:
         pass
     else:
         while True:
             line = stdouterr.readline()
             if not line:
                 break
             Li.append(line.rstrip())
         result = "".join(Li)
     code = proc.wait()
     time.sleep(2)
     L.debug("Command Resturn Code: %d" % code)
     self.queue.put(result)
开发者ID:setsulla,项目名称:bantorra,代码行数:30,代码来源:cmd.py

示例2: __add_router_interface

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
    def __add_router_interface(self):

        # and pick the first in the list - the list should be non empty and
        # contain only 1 subnet since it is supposed to be a private network

        # But first check that the router does not already have this subnet
        # so retrieve the list of all ports, then check if there is one port
        # - matches the subnet
        # - and is attached to the router
        # Assumed that both management networks are created together so checking for one of them
        ports = self.neutron_client.list_ports()['ports']
        for port in ports:
            # Skip the check on stale ports
            if port['fixed_ips']:
                port_ip = port['fixed_ips'][0]
                if (port['device_id'] == self.ext_router['id']) and \
                   (port_ip['subnet_id'] == self.vm_int_net[0]['subnets'][0]):
                    LOG.info('Ext router already associated to the internal network.')
                    return

        for int_net in self.vm_int_net:
            body = {
                'subnet_id': int_net['subnets'][0]
            }
            self.neutron_client.add_interface_router(self.ext_router['id'], body)
            LOG.debug('Ext router associated to ' + int_net['name'])
            # If ipv6 is enabled than add second subnet
            if self.ipv6_enabled:
                body = {
                    'subnet_id': int_net['subnets'][1]
                }
                self.neutron_client.add_interface_router(self.ext_router['id'], body)
开发者ID:sebrandon1,项目名称:vmtp,代码行数:34,代码来源:network.py

示例3: throwRandomData

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def throwRandomData(self):
     rsize = 128
     rand = str(random.getrandbits(rsize))
     res = struct.pack("%ds"%rsize, rand)
     LOG.debug(" fuzzing with %d bytes: '%s'" % (rsize, rand))
     for i in range(0,127):
         self.sendMsg_UDP(i, res)
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:9,代码来源:client.py

示例4: commandReceived

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
	def commandReceived(self, cmd):
		if cmd.commandid in const.command_names.keys():
			LOG.debug("got command: %d(%s) from company %d: '%s'" % (cmd.cmd, const.command_names[cmd.commandid].__str__(), cmd.company + 1, cmd.text))

		ctime = time.time()
		companystr = self.client.getCompanyString(cmd.company)

		if cmd.company in self.companyIdling and cmd.company != const.PLAYER_SPECTATOR:
			# remove from that list
			idx = self.companyIdling.index(cmd.company)
			del self.companyIdling[idx]
			timediff = ctime - self.companyLastAction[cmd.company]
			if timediff > self.idletime:
				# we were here already, check if we got back from idling
				Broadcast("%s is back from idling after %s" % (companystr, self.timeFormat(timediff)), parentclient=self.client)
			
		self.companyLastAction[cmd.company] = ctime
		
		if cmd.commandid == const.commands['CMD_PLACE_SIGN'] and cmd.text != '':
			Broadcast("%s placed a sign: '%s'" % (companystr, cmd.text), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_RENAME_SIGN'] and cmd.text != '':
			Broadcast("%s renames a sign: '%s'" % (companystr, cmd.text), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_SET_COMPANY_COLOUR']:
			Broadcast("%s changed their color" % companystr, parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_RENAME_COMPANY']:
			Broadcast("%s changed their company name to '%s'"%(companystr, cmd.text), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_SET_COMPANY_MANAGER_FACE']:
			Broadcast("%s changed their company face"%(companystr), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_RENAME_PRESIDENT']:
			Broadcast("%s changed their presidents name to '%s'"%(companystr, cmd.text), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_BUILD_INDUSTRY']:
			Broadcast("%s built a new industry"%(companystr), parentclient=self.client)
		elif cmd.commandid == const.commands['CMD_BUILD_COMPANY_HQ']:
			Broadcast("%s built or relocated their HQ"%(companystr), parentclient=self.client)
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:36,代码来源:playerinfo.py

示例5: receiveMsg_TCP

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def receiveMsg_TCP(self, datapacket = False):
     if self.socket_tcp is None:
         raise _error.ConnectionError("no tcp socket for receiving")
     raw = ""
     note = ""
     data, readcounter = self.receive_bytes(self.socket_tcp, const.HEADER.size)
     if readcounter > 1:
         note += "HEADER SEGMENTED INTO %s SEGMENTS!" % readcounter
     raw += data
     size, command = networking.parsePacketHeader(data)
     if not command in (const.PACKET_SERVER_FRAME, const.PACKET_SERVER_SYNC):
         if command in const.packet_names:
             LOG.debug("received size: %d, command: %s (%d)"% (size, const.packet_names[command], command))
         else:
             LOG.debug("received size: %d, command: %d"% (size, command))
     size -= const.HEADER.size # remove size of the header ...
     data, readcounter = self.receive_bytes(self.socket_tcp, size)
     if readcounter > 1:
         note += "DATA SEGMENTED INTO %s SEGMENTS!" % readcounter
     raw += data
     if not self.running:
         return None
     if len(note) > 0:
         LOG.info(note)
     content = data
     
     if datapacket:
         return DataPacket(size, command, content)
     else:
         return size, command, content
     #content = struct.unpack(str(size) + 's', data)
     #content = content[0]
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:34,代码来源:client.py

示例6: place_block

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
    def place_block(self, block, pos, ignore_top=True):
        """
        Updates the board by placing `block` at the position `pos`.
        """
        LOG.debug("Placing %s at %s" % (block, pos))

        solid_squares = block.get_solid_squares()
        heighest_columns = [0] * self.width

        for (x,y) in solid_squares:
            final_x, final_y = pos[0]+x, pos[1]+y

            if ignore_top and final_y >= self.height:
                continue

            assert self.valid_position(final_x, final_y, ignore_top), \
                "Trying to place %s outside the board limits! (%s)" % (block, pos)

            if self.board[final_y][final_x] != None:
                LOG.critical("Writing on (%d,%d), a position of the" % (final_x, final_y) + \
                        "board already filled, something wrong happend!")

            self.board[final_y][final_x] = block

            if final_y >= heighest_columns[final_x]:
                heighest_columns[final_x] = final_y + 1

        for (x, _) in solid_squares:
            final_x = pos[0]+x

            if heighest_columns[final_x] > self._column_heights[final_x]:
                self._column_heights[final_x] = heighest_columns[final_x]
开发者ID:abranches,项目名称:pythonista-tetris-bot,代码行数:34,代码来源:board.py

示例7: stopWebserver

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def stopWebserver(self, event, command):
     if self.webserverthread is None or (config.getboolean("main", "productive") and not event.isByOp()):
         return
     LOG.debug("stopping webserver ...")
     self.webserverthread.stop()
     self.webserverthread = None
     Broadcast("webserver stopped", parentclient=self.client, parent=event)
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:9,代码来源:webserver.py

示例8: clearStats

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def clearStats(self):
     if not config.getboolean('stats', 'enable'): return
     fn = config.get("stats", "cachefilename")
     try:
         os.remove(fn)
         LOG.debug("stats cleared")
     except:
         pass
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:10,代码来源:webserver.py

示例9: parse_config

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
def parse_config(filename):
    """
    Fnord
    """
    # {{{
    filename = expanduser(expandvars(filename))
    LOG.debug("Parsing configuration in file '%s'",filename)
    CONFIG.read(filename)
开发者ID:turbofish,项目名称:mcverify,代码行数:10,代码来源:main.py

示例10: __exec_light

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
    def __exec_light(self, cmd, timeout=TIMEOUT):
        proc = BantorraLightProcess(cmd, self.queue)
        proc.start()
        proc.join(timeout)

        if proc.is_alive():
            proc.kill()
            time.sleep(1)
            L.debug("proc.terminate. %s" % proc.is_alive())
开发者ID:setsulla,项目名称:bantorra,代码行数:11,代码来源:cmd.py

示例11: init

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
	def init(self):
		LOG.debug("PlayerInfoPlugin started")
		self.updateConfig()
		self.enabled  = config.getboolean('playerinfos', 'enable')
		self.idletime = config.getint    ('playerinfos', 'idletime')
		self.registerCallback("on_receive_command", self.commandReceived)
		self.registerCallback("on_mainloop", self.onMainLoop)
		self.registerChatCommand("stopinfo", self.stopInfo)
		self.registerChatCommand("idleinfo", self.idleInfo)
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:11,代码来源:playerinfo.py

示例12: startWebserver

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def startWebserver(self, event, command):
     if config.getboolean("main", "productive") and not event.isByOp():
         return
     if not config.getboolean("webserver", "enable") or not self.webserverthread is None:
         return
     LOG.debug("starting webserver ...")
     self.webserverthread = WebserverThread(self.client)
     self.webserverthread.start()
     Broadcast("webserver started on port %d"% self.webserverthread.port, parentclient=self.client, parent=event)
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:11,代码来源:webserver.py

示例13: move_down

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
    def move_down(self):
        LOG.debug("ENGINE - move down")
        self._restart_timeout = True
        if self.game_state.drop_block_is_stuck():
            done_lines = self.game_state.move_block_down()
            self.game_state.start_new_drop()
            return done_lines

        self.game_state.move_block_down()
        return 0
开发者ID:abranches,项目名称:pythonista-tetris-bot,代码行数:12,代码来源:engine.py

示例14: get_tags

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def get_tags(self):
     LOG.info("Getting tags from openttd finger server")
     LOG.debug("HTTP GET %s" % const.OPENTTD_FINGER_TAGS_URL)
     self.request("GET", const.OPENTTD_FINGER_TAGS_URL)
     r1 = self.getresponse()
     LOG.debug("%d %s" % (r1.status, r1.reason))
     if r1.status != 200:
         raise Exception("Couldn't request tags list")
     data1 = r1.read()
     data2 = [i.strip().split() for i in data1.split('\n') if i]
     data2 = [(int(i[0]), dateutil.parser.parse(i[1]).date(), i[2].strip()) for i in data2]
     self.tags = data2
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:14,代码来源:version.py

示例15: disconnect

# 需要导入模块: from log import LOG [as 别名]
# 或者: from log.LOG import debug [as 别名]
 def disconnect(self, mode=M_BOTH):
     if not self.socket_tcp is None and mode & M_TCP:
         LOG.debug('closing TCP socket')
         self.socket_tcp.close()
         self.socket_tcp = None
     if not self.socket_udp is None and mode & M_UDP:
         LOG.debug('closing UDP socket')
         self.socket_udp.close()
         self.socket_udp = None
     self.connectionmode &= ~mode
     if self.connectionmode == M_NONE:
         self.running = False
开发者ID:bridgeduan,项目名称:openttd-python,代码行数:14,代码来源:client.py


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