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


Python LOG.error方法代码示例

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


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

示例1: got_have

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def got_have(self, message):
     i = toint(message[1:])
     if i >= self.torrent.numpieces:
         log.error("Piece index out of range")
         self.fatal_error()
         return
     self.download.got_have(i)
开发者ID:Miserlou,项目名称:Anomos,代码行数:9,代码来源:AnomosEndPointProtocol.py

示例2: get_ctx

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def get_ctx(self, allow_unknown_ca=False, req_peer_cert=True, session=None):
     ctx = SSL.Context("sslv23")
     # Set certificate and private key
     m2.ssl_ctx_use_x509(ctx.ctx, self.cert.x509)
     m2.ssl_ctx_use_rsa_privkey(ctx.ctx, self.rsakey.rsa)
     if not m2.ssl_ctx_check_privkey(ctx.ctx):
         raise CryptoError('public/private key mismatch')
     # Ciphers/Options
     ctx.set_cipher_list(CIPHER_SET)
     ctx.set_options(CTX_OPTIONS)
     # CA settings
     cloc = os.path.join(global_certpath, 'cacert.root.pem')
     if ctx.load_verify_locations(cafile=cloc) != 1:
         log.error("Problem loading CA certificates")
         raise CryptoError('CA certificates not loaded')
     # Verification
     cb = mk_verify_cb(allow_unknown_ca=allow_unknown_ca)
     CTX_V_FLAGS = SSL.verify_peer
     if req_peer_cert:
         CTX_V_FLAGS |= SSL.verify_fail_if_no_peer_cert
     ctx.set_verify(CTX_V_FLAGS,3,cb)
     # Session
     if session:
         ctx.set_session_id_ctx(session)
     return ctx
开发者ID:Miserlou,项目名称:Anomos,代码行数:27,代码来源:_Certificate.py

示例3: got_tcode

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def got_tcode(self, message):
     tcreader = TCReader(self.manager.certificate)
     try:
         tcdata = tcreader.parseTC(message[1:])
     except Anomos.Crypto.CryptoError, e:
         log.error("Decryption Error: %s" % str(e))
         self.socket.close()
         return
开发者ID:Miserlou,项目名称:Anomos,代码行数:10,代码来源:AnomosNeighborProtocol.py

示例4: got_partial

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def got_partial(self, message):
     p_remain = toint(message[1:5])
     self.partial_recv += message[5:]
     if len(self.partial_recv) > self.neighbor.config['max_message_length']:
         log.error("Received message longer than max length")
         return
     if len(message[5:]) == p_remain:
         self.got_message(self.partial_recv)
         self.partial_recv = ''
开发者ID:Miserlou,项目名称:Anomos,代码行数:11,代码来源:AnomosRelayerProtocol.py

示例5: start_circuit

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
    def start_circuit(self, tc, infohash, aeskey):
        """Called from Rerequester to initialize new circuits we've
        just gotten TCs for from the Tracker"""
        if self.count_streams() >= self.config['max_initiate']:
            log.warning("Not starting circuit -- Stream count exceeds maximum")
            return

        tcreader = TCReader(self.certificate)
        try:
            tcdata = tcreader.parseTC(tc)
        except Anomos.Crypto.CryptoError, e:
            log.error("Decryption Error: %s" % str(e))
            return
开发者ID:Miserlou,项目名称:Anomos,代码行数:15,代码来源:NeighborManager.py

示例6: __init__

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
    def __init__(self, url, config, schedule, neighbors, amount_left,
            up, down, local_port, infohash, doneflag,
            diefunc, sfunc, certificate, sessionid):
        ##########################
        self.config = config
        self.schedule = schedule
        self.neighbors = neighbors
        self.amount_left = amount_left
        self.up = up
        self.down = down
        self.local_port = local_port
        self.infohash = infohash
        self.doneflag = doneflag
        self.diefunc = diefunc
        self.successfunc = sfunc
        self.certificate = certificate
        self.ssl_ctx = self.certificate.get_ctx(allow_unknown_ca=False)
        self.sessionid = sessionid
        ### Tracker URL ###
        self.https = True

        parsed = urlparse(url)     # (<scheme>,<netloc>,<path>,<params>,<query>,<fragment>)
        self.url = parsed[1]
        self.remote_port = 5555 # Assume port 5555 by default

        if ":" in self.url:                #   <netloc> = <url>:<port>
            i = self.url.index(":")
            self.remote_port = int(self.url[i+1:])
            self.url = self.url[:i]
        self.path = parsed[2]
        self.basequery = None

        self.failed_peers = []
        self.changed_port = False
        self.announce_interval = 30 * 60
        self.finish = False
        self.current_started = None
        self.fail_wait = None
        self.last_time = None
        self.warned = False
        self.proxy_url = self.config.get('tracker_proxy', None)
        self.proxy_username = None
        self.proxy_password = None
        if self.proxy_url:
            self.parse_proxy_url()
        if parsed[0] != 'https':
            log.error("You are trying to make an unencrypted connection to a tracker, and this has been disabled for security reasons. Halting.")
            self.https = False
开发者ID:Miserlou,项目名称:Anomos,代码行数:50,代码来源:Rerequester.py

示例7: _postrequest

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def _postrequest(self, data=None, errormsg=None):
     self.current_started = None
     self.last_time = bttime()
     if errormsg is not None:
         log.warning(errormsg)
         self._fail()
         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
开发者ID:Miserlou,项目名称:Anomos,代码行数:18,代码来源:Rerequester.py

示例8: save_ui_config

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
def save_ui_config(defaults, section, save_options):
    p = SafeConfigParser()
    filename = os.path.join(defaults['data_dir'], 'ui_config')
    p.read(filename)
    p.remove_section(section)
    p.add_section(section)
    for name in save_options:
        p.set(section, name, str(defaults[name]))
    try:
        f = file(filename, 'w')
        p.write(f)
        f.close()
    except Exception, e:
        try:
            f.close()
        except:
            pass
        log.error('Could not permanently save options: '+ str(e))
开发者ID:Miserlou,项目名称:Anomos,代码行数:20,代码来源:configfile.py

示例9: set_filesystem_encoding

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
def set_filesystem_encoding(encoding):
    global filesystem_encoding
    filesystem_encoding = 'ascii'
    if encoding == '':
        try:
            sys.getfilesystemencoding
        except AttributeError:
            log.warning("This seems to be an old Python version which does not support detecting the filesystem encoding. Assuming 'ascii'.")
            return
        encoding = sys.getfilesystemencoding()
        if encoding is None:
            log.warning("Python failed to autodetect filesystem encoding. Using 'ascii' instead.")
            return
    try:
        'a1'.decode(encoding)
    except:
        log.error("Filesystem encoding '"+encoding+"' is not supported. Using 'ascii' instead.")
        return
    filesystem_encoding = encoding
开发者ID:Miserlou,项目名称:Anomos,代码行数:21,代码来源:ConvertedMetainfo.py

示例10: got_exception

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [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

示例11: bdecode

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 if errormsg is not None:
     log.warning(errormsg)
     self._fail()
     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'])
开发者ID:Miserlou,项目名称:Anomos,代码行数:33,代码来源:Rerequester.py

示例12: reread_config

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def reread_config(self):
     try:
         newvalues = configfile.get_config(self.config, 'anondownloadcurses')
     except Exception, e:
         log.error('Error reading config: ' + str(e))
         return
开发者ID:Miserlou,项目名称:Anomos,代码行数:8,代码来源:anondownloadheadless.py

示例13: got_exception

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def got_exception(self, e):
     log.error(e)
开发者ID:Miserlou,项目名称:Anomos,代码行数:4,代码来源:Relayer.py

示例14: fatal_error

# 需要导入模块: from Anomos import LOG [as 别名]
# 或者: from Anomos.LOG import error [as 别名]
 def fatal_error(self, msg=""):
     log.error(msg)
     self.close()
开发者ID:Miserlou,项目名称:Anomos,代码行数:5,代码来源:EndPoint.py


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