本文整理汇总了Python中Anomos.LOG.critical方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.critical方法的具体用法?Python LOG.critical怎么用?Python LOG.critical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomos.LOG
的用法示例。
在下文中一共展示了LOG.critical方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_reader
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def get_reader(self):
if self.collector:
if self.new_collector:
self.new_collector = False
return self.collector.get_reader()
else:
log.critical("Request for a reader was made before " \
"a connection was assigned a collector")
raise RuntimeError("Unable to get data collector")
示例2: loop
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def loop(self):
try:
while not self.doneflag.isSet():
self._pop_externally_added()
period = 1e9
if len(self.tasks) > 0:
# Poll until the next task is set to execute
period = max(0, self.tasks[0][0] - bttime())
asyncore.poll(period)
self.do_tasks()
except KeyboardInterrupt:
#TODO: cleanup?
pass
except:
log.critical('\n'+traceback.format_exc())
示例3: got_exception
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def got_exception(self, e):
is_external = False
if isinstance(e, BTShutdown):
log.error(str(e))
is_external = True
elif isinstance(e, BTFailure):
log.critical(str(e))
self._activity = ("download failed: " + str(e), 0)
elif isinstance(e, IOError):
log.critical("IO Error " + str(e))
self._activity = ("killed by IO error: " + str(e), 0)
elif isinstance(e, OSError):
log.critical("OS Error " + str(e))
self._activity = ("killed by OS error: " + str(e), 0)
else:
data = StringIO()
print_exc(file=data)
log.critical(data.getvalue())
self._activity = ("killed by internal exception: " + str(e), 0)
try:
self._close()
except Exception, e:
log.error("Additional error when closing down due to " "error: " + str(e))
示例4: bdecode
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
return
try:
# Here's where we receive/decrypt data from the tracker
r = bdecode(data)
check_peers(r)
except BTFailure, e:
if data != '':
log.error('bad data from tracker - ' + str(e))
self._fail()
return
if r.has_key('failure reason'):
if self.neighbors.count() > 0:
log.error('rejected by tracker - ' + r['failure reason'])
else:
log.critical("Aborting the torrent as it was " \
"rejected by the tracker while not connected to any peers. " \
"Message from the tracker:\n" + r['failure reason'])
self._fail()
return
elif self.neighbors is None:
# Torrent may have been closed before receiving a response
# from the tracker.
self._fail()
return
else:
self.fail_wait = None
if r.has_key('warning message'):
log.error('warning from tracker - ' + r['warning message'])
self.announce_interval = r.get('interval', self.announce_interval)
self.config['rerequest_interval'] = self.announce_interval
#r.get('min interval', self.config['rerequest_interval'])
示例5: handle_expt
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def handle_expt(self):
if self.bound:
log.critical('\n'+traceback.format_exc())
self.clear()
示例6: find_port
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
serversocket.close()
del self.ports[port]
def find_port(self, listen_fail_ok=True):
e = 'maxport less than minport - no ports to check'
self.config['minport'] = max(1, self.config['minport'])
for port in xrange(self.config['minport'], self.config['maxport'] + 1):
try:
self.open_port(port)
break
except socketerror, e:
pass
else:
if not listen_fail_ok:
raise BTFailure, "Couldn't open a listening port: " + str(e)
log.critical("Could not open a listening port: " +
str(e) + ". Check your port range settings.")
def open_port(self, port):
if port in self.ports:
self.port = port
return
serversocket = P2PServer(self.config['bind'], port, self.ssl_ctx)
oldport = self.port
self.port = port
self.ports[port] = [serversocket, 0]
self._check_close(oldport)
def get_port(self, nbrmgr):
if self.port:
self.ports[self.port][0].set_neighbor_manager(nbrmgr)
self.ports[self.port][1] += 1
示例7: handle_expt
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def handle_expt(self):
log.critical("Exception encountered!")
self.close()
示例8: handle_error
# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
def handle_error(self):
log.critical('\n'+traceback.format_exc())
self.close()