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


Python LOG.critical方法代码示例

本文整理汇总了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")
开发者ID:Miserlou,项目名称:Anomos,代码行数:11,代码来源:P2PConnection.py

示例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())
开发者ID:Miserlou,项目名称:Anomos,代码行数:17,代码来源:EventHandler.py

示例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))
开发者ID:Miserlou,项目名称:Anomos,代码行数:25,代码来源:download.py

示例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'])
开发者ID:Miserlou,项目名称:Anomos,代码行数:33,代码来源:Rerequester.py

示例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()
开发者ID:Miserlou,项目名称:Anomos,代码行数:6,代码来源:P2PServer.py

示例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
开发者ID:Miserlou,项目名称:Anomos,代码行数:34,代码来源:SingleportListener.py

示例7: handle_expt

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import critical [as 别名]
 def handle_expt(self):
     log.critical("Exception encountered!")
     self.close()
开发者ID:Miserlou,项目名称:Anomos,代码行数:5,代码来源:Dispatcher.py

示例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()
开发者ID:Miserlou,项目名称:Anomos,代码行数:5,代码来源:controlsocket.py


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