• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python log.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: succeed

			def succeed(*args, **kwargs):
				log.debug("ClientQueue: success, queue size %d, reqs out %d" % (len(self.queue), self.count))
				self.count -= 1
				try:
					success(*args, **kwargs)
				except Exception, e:
					log.err("Exception '%s' in ClientQueue callback; moving on" % str(e))
开发者ID:nickretallack,项目名称:couchdb-lounge,代码行数:7,代码来源:proxy.py


示例2: preApplication

 def preApplication(self):
     """
     We don't actually want to override this method since there is nothing
     interesting to do in here.
     """
     log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunner", "preApplication")
     pass
开发者ID:hellais,项目名称:GLBackend,代码行数:7,代码来源:runner.py


示例3: dispatch

	def dispatch(self, msg):
		# Get the artifact signature id
		match = self.regex.search(msg)
		if not match:
			log.debug('Failed to match snort rule-signature in msg: {!r}'.format(msg))
			return msg
		sig = match.group('sig')

		# Check if traffic dump should be generated
		dump = False
		if self.conf.traffic_dump.match_exclude:
			for regex in self.conf.traffic_dump.match_exclude:
				if re.search(regex, msg):
					dump = None
					break
		if dump is not None:
			if sig in self.conf.traffic_dump.signatures: dump = True
			if not dump and self.conf.traffic_dump.match:
				for regex in self.conf.traffic_dump.match:
					if re.search(regex, msg):
						dump = True
						break

		if dump:
			try: dump = self.traffic_dump()
			except Exception as err:
				msg += '\n  dump failed: {}'.format(err)
			else: msg += '\n  dump: {}'.format(dump)

		return msg
开发者ID:mk-fg,项目名称:bordercamp-irc-bot,代码行数:30,代码来源:pipe_snort_nflog.py


示例4: dispatch

    def dispatch(self, msg):
        for pat, pat_re in self.patterns.viewitems():
            if pat_re.search(msg):
                log.debug("Matched nflog-dump pattern: {}".format(pat))
                break
        else:
            return

        ts = time()
        if self.conf.traffic_dump.min_interval and self.last_dump > ts - self.conf.traffic_dump.min_interval:
            log.debug(
                "Ignoring nflog-dump pattern match"
                " ({}) due to rate-limiting (elapsed: {:.1f}, min: {})".format(
                    pat, ts - self.last_dump, self.conf.traffic_dump.min_interval
                )
            )
            return
        self.last_dump = ts

        msg = "Matched nflog-dump pattern: {}".format(pat)
        try:
            dump = self.traffic_dump(ts=ts)
        except Exception as err:
            msg += "\n  dump failed: {}".format(err)
        else:
            msg += "\n  dump: {}".format(dump)

        return msg
开发者ID:mk-fg,项目名称:bordercamp-irc-bot,代码行数:28,代码来源:pipe_nflog_snapshots.py


示例5: __reduce

	def __reduce(self):
		"""Pull stuff off the queue."""
		#only need to reduce if there is more than one item in the queue
		if len(self.queue) == 1:
			#if we've received all the results from all the shards
			#and the queue only has 1 element in it, then we're done reducing
			if self.num_entries_remaining == 0 and self.reduces_out == 0:
				# if this was a count query, slice stuff off
				if self.count is not None:
					log.debug("count: %d, skip: %d, results: %d" % (self.count, self.skip, len(self.queue[0]['rows'])))
					self.queue[0]['rows'] = self.queue[0]['rows'][self.skip:self.skip+self.count]
				elif self.skip > 0:
					self.queue[0]['rows'] = self.queue[0]['rows'][self.skip:]
				body = cjson.encode(self.queue[0])
				# filter headers that should not be reverse proxied
				strip_headers = ['content-length', 'etag']
				headers = dict([(k,v) for k,v in self.headersrecvd.iteritems() if k.lower() not in strip_headers])
				
					# calculate a deterministic etag
				nodes = self.etags.keys()
				nodes.sort() # sum in deterministic order
				md5etag = md5.md5()
				for node in nodes:
					md5etag.update(self.etags[node])
				if len(nodes) > 0:
					headers['etag'] = ['"%s"' % md5etag.hexdigest()]
				log.debug("Reducer: response headers = %s" % str(headers))
				self.reduce_deferred.callback((self.coderecvd, headers, body))
			return

		a,b = self.queue[:2]
		self.queue = self.queue[2:]
		# hand the work off to _do_reduce, which we can override
		self._do_reduce(a,b)
开发者ID:awesome,项目名称:smartproxy,代码行数:34,代码来源:reducer.py


示例6: dispatch

	def dispatch(self, msg):
		match = self.regex.search(msg)
		if not match:
			log.debug('Failed to match snort rule-sid in msg: {!r}'.format(msg))
			return msg
		sid = match.group('sid')

		if self.gid_ignore:
			try: gid = match.group('gid')
			except IndexError: pass
			else:
				if gid in self.gid_ignore: return msg

		ts = time()
		if self.sid_db_ts < ts - self.conf.sid_db_mtime_check_interval:
			if not os.path.exists(self.conf.paths.sid_db)\
					or max(0, *( os.stat(p).st_mtime
						for p in [self.conf.paths.sid_src, self.conf.paths.refs]
						if os.path.exists(p) )) > os.stat(self.conf.paths.sid_db).st_mtime:
				self.update_sid_db()
			self.sid_db = anydbm.open(self.conf.paths.sid_db)

		try: ref = force_unicode(self.sid_db[force_bytes(sid)])
		except KeyError:
			log.info('Failed to find refs for sid: {!r} (msg: {!r})'.format(sid, msg))
		else: msg += u'\n  refs: {}'.format(ref)
		return msg
开发者ID:mk-fg,项目名称:bordercamp-irc-bot,代码行数:27,代码来源:pipe_snort_references.py


示例7: socks_method_CONNECT

    def socks_method_CONNECT (self):
        # Check if we have ip address or domain name
        #
	log.debug("socks_method_CONNECT host = " + self.host)

 	# The FaceTime SOCKS5 proxy treats IP addr the same way as hostname
       # if _ip_regex.match (self.host):
       #     # we have dotted quad IP address
       #     addressType = 1
       #     address = socket.inet_aton (self.host)
       # else:
       #     # we have host name
       #     address = self.host
       #     addressType = 3

	address = self.host
	addressType = 3
	addressLen = len(address)

        #Protocol version=5, Command=1 (CONNECT), Reserved=0
        #command = struct.pack ("!BBBB", 5, 1, 0, addressType)

	command = struct.pack ("!BBBBB", 5, 1, 0, addressType,addressLen)
        portstr = struct.pack ("!H", self.port)

        self.transport.write (command + address + portstr)
        self.state = "gotConnectReply"
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:27,代码来源:socks5.py


示例8: socks_gotHelloReply

    def socks_gotHelloReply (self, data):
        """ Receive server greeting and send authentication or ask to
        execute requested method right now.
        """
        if data == "\x05\xFF":
            # No acceptable methods. We MUST close
            #
	    log.debug("No acceptable methods, closing connection")
            self.transport.loseConnection()
            return

        elif data == "\x05\x00":
            # Anonymous access allowed - let's issue connect
            #
            self.sendCurrentMethod()

        elif data == "\x05\x02":
            # Authentication required
            #
            self.sendAuth()

        else:
            self.transport.loseConnection()
            self.factory.clientConnectionFailed (self, failure.Failure (
                UnhandledData ("Server returned unknown reply in gotHelloReply")))

        # From now on SOCKS server considered alive - we've got reply
        #
        self.factory.status = "connected"
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:29,代码来源:socks5.py


示例9: answer

 def answer(self, transport, recipient, message):
   user = self.auth.authenticate(recipient)
   if user:
     session = USSDSession.objects.recent(user)
     if session:
       log.debug("User: %s USSD Session: %s" % (user, session))
       msg = str(message)
       if msg == "$start":
         response = handle_start(session)
       elif msg == "$end":
         response = handle_end(session)
       elif msg == "$error":
         import pdb
         pdb.set_trace()
       else:
         if session.current_menu and not session.current_menu.is_finished():
           response = handle_session(session, msg)
         else:
           response = "Use $start to create menu"
       if recipient and response:
         transport(recipient, response)
       else:
         log.error("Either recipient (%s) or response (%s) is not valid!" % (recipient, response))
       return
     else:
       transport(recipient, "Error: No USSD Session!")
   else:
     transport(recipient, "Error: No User!")
开发者ID:jbrownbridge,项目名称:spaza,代码行数:28,代码来源:xmpp.py


示例10: run

 def run(self):
     log.debug('[Task] running')
     self._running = True
     self._aborted = False
     
     o = (self.fnc, self.args, self.kwargs, self.onComplete)
     fnc_queue.put(o)
开发者ID:easyspider,项目名称:archivczsk,代码行数:7,代码来源:task.py


示例11: dataReceived

  def dataReceived(self, recd):
    self.recvd = self.recvd + recd
    while len(self.recvd) >= 10:

      # hack for DeLorme EarthMate
      if self.recvd[:8] == 'EARTHA\r\n':
        if self.allow_earthmate_hack:
          self.allow_earthmate_hack = 0
          self.transport.write('EARTHA\r\n')
        self.recvd = self.recvd[8:]
        continue
      
      if self.recvd[0:2] != '\xFF\x81':
        if DEBUG:
          raise ZodiacParseError('Invalid Sync %r' % self.recvd)
        else:
          raise ZodiacParseError
      sync, msg_id, length, acknak, checksum = struct.unpack('<HHHHh', self.recvd[:10])
      
      # verify checksum
      cksum = -(reduce(operator.add, (sync, msg_id, length, acknak)) & 0xFFFF)
      cksum, = struct.unpack('<h', struct.pack('<h', cksum))
      if cksum != checksum:
        if DEBUG:
          raise ZodiacParseError('Invalid Header Checksum %r != %r %r' % (checksum, cksum, self.recvd[:8]))
        else:
          raise ZodiacParseError
      
      # length was in words, now it's bytes
      length = length * 2

      # do we need more data ?
      neededBytes = 10
      if length:
        neededBytes += length + 2
      if len(self.recvd) < neededBytes:
        break
      
      if neededBytes > self.MAX_LENGTH:
        raise ZodiacParseError("Invalid Header??")

      # empty messages pass empty strings
      message = ''

      # does this message have data ?
      if length:
        message, checksum = self.recvd[10:10+length], struct.unpack('<h', self.recvd[10+length:neededBytes])[0]
        cksum = 0x10000 - (reduce(operator.add, struct.unpack('<%dH' % (length/2), message)) & 0xFFFF)
        cksum, = struct.unpack('<h', struct.pack('<h', cksum))
        if cksum != checksum:
          if DEBUG:
            log.debug('msg_id = %r length = %r' % (msg_id, length))
            raise ZodiacParseError('Invalid Data Checksum %r != %r %r' % (checksum, cksum, message))
          else:
            raise ZodiacParseError
      
      # discard used buffer, dispatch message
      self.recvd = self.recvd[neededBytes:]
      self.receivedMessage(msg_id, message, acknak)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:59,代码来源:rockwell.py


示例12: fail

			def fail(*args, **kwargs):
				log.debug("ClientQueue: failure, queue size %d, reqs out %d" % (len(self.queue), self.count))
				self.count -= 1
				try:
					err(*args, **kwargs)
				except:
					log.err("Exception in ClientQueue errback; moving on")
				self.next()
开发者ID:nickretallack,项目名称:couchdb-lounge,代码行数:8,代码来源:proxy.py


示例13: twisted_log

def twisted_log(eventDict):
    log = logging.getLogger('twisted')
    if 'failure' in eventDict:
        log.error(eventDict.get('why') or 'Unhandled exception' + '\n' + str(eventDict['failure'].getTraceback()))
    elif 'warning' in eventDict:
        log.warning(eventDict['warning'])
    else:
        log.debug(' '.join([str(m) for m in eventDict['message']]))
开发者ID:B-Rich,项目名称:ibid-1,代码行数:8,代码来源:__init__.py


示例14: _sendResponse

 def _sendResponse(self, data, request, requestID, error=''):
     response = json.dumps(
       {'request': request, 'requestID': requestID,
        'data': data,
        'error': error}
     )
     log.debug('Sending response: %s' % response)
     self.sendString(response)
开发者ID:linnea-s,项目名称:sepiida,代码行数:8,代码来源:__init__.py


示例15: inform

 def inform():
     if len(obs.orderbook.bids) > 0:
         try:
             print("Highest bid {:.2f}, lowest ask {:.2f}; lowest bid {:.2f} and highest ask {:.2f}.".format(
                   obs.highestbid, obs.lowestask, obs.orderbook.bids[-1].price, obs.orderbook.asks[-1].price))
             pass
         except TypeError as e:
             log.debug("Error: {0}".format(e.message))
开发者ID:MikeAmy,项目名称:exchangelib,代码行数:8,代码来源:observer.py


示例16: dataReceived

	def dataReceived(self, data):
		recs = data.strip().split('\n')
		for rec in recs:
			self.model.feedAccumulator(rec)
			
		if self.model.hasEnoughData():
			log.debug("Model has enough data to execute the loop...")
			self.model.run()
开发者ID:moon2l,项目名称:xpdbg,代码行数:8,代码来源:xpdbg.py


示例17: _send

 def _send(self, op):
     if not self.connected:
         raise LDAPClientConnectionLostException()
     msg=pureldap.LDAPMessage(op)
     if self.debug:
         log.debug('C->S %s' % repr(msg))
     assert not self.onwire.has_key(msg.id)
     return msg
开发者ID:KenMacD,项目名称:ldaptor,代码行数:8,代码来源:ldapclient.py


示例18: send_flow_stats_request_timer

	def send_flow_stats_request_timer(self, dpid):
		log.debug("I am able to enter the flow_stats_request_timer method.")
		global xid
		flows = of.ofp_match()
		flows.wildcards = of.OFPFW_ALL #wildcarded all match fields, which means that all the flows will be retrieved.
		self.Monitoring.send_flow_stats_request(dpid, flows, 0xff, xid)
		xid += 1
		self.post_callback(FLOW_MONITOR_INTERVAL, lambda : self.send_flow_stats_request_timer(dpid))
开发者ID:homework,项目名称:hwdb,代码行数:8,代码来源:flow_stats.py


示例19: chat

 def chat(self, to, body):
   message = domish.Element((None, 'message'))
   message['to'] = to
   message['from'] = self.parent.jid.full()
   message['type'] = 'chat'
   message.addElement('body', content=body)
   self.xmlstream.send(message)
   log.debug(u"Sent %s message (len=%d) to %s: %s" % (message['type'], len(str(message.body)), message['to'], message.body))
开发者ID:jbrownbridge,项目名称:spaza,代码行数:8,代码来源:xmpp.py


示例20: childDataReceived

	def childDataReceived(self, childFD, response):
		log.debug("Received data from reducer %s" % response)
		if childFD == 1:
			self.response += response
			# should get one line back for each line we sent (plus one for trailing newline)
			response_lines = len(self.response.split("\n"))
			if response_lines>len(self.lines):
				self._deferred.callback( (self.keys, self.response) )
开发者ID:awesome,项目名称:smartproxy,代码行数:8,代码来源:reducer.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.deferr函数代码示例发布时间:2022-05-27
下一篇:
Python log.callWithLogger函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap