本文整理汇总了Python中exabgp.logger.FakeLogger.error方法的典型用法代码示例。如果您正苦于以下问题:Python FakeLogger.error方法的具体用法?Python FakeLogger.error怎么用?Python FakeLogger.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exabgp.logger.FakeLogger
的用法示例。
在下文中一共展示了FakeLogger.error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Peer
# 需要导入模块: from exabgp.logger import FakeLogger [as 别名]
# 或者: from exabgp.logger.FakeLogger import error [as 别名]
class Peer (object):
def __init__ (self, neighbor, reactor):
try:
self.logger = Logger()
# We only to try to connect via TCP once
self.once = environment.settings().tcp.once
self.bind = True if environment.settings().tcp.bind else False
except RuntimeError:
self.logger = FakeLogger()
self.once = False
self.bind = True
now = time.time()
self.reactor = reactor
self.neighbor = neighbor
# The next restart neighbor definition
self._neighbor = None
self.proto = None
self.fsm = FSM(self,FSM.IDLE)
self.stats = {
'fsm': self.fsm,
'creation': now,
'reset': now,
'complete': 0,
}
self.generator = None
# The peer should restart after a stop
self._restart = True
# The peer was restarted (to know what kind of open to send for graceful restart)
self._restarted = FORCE_GRACEFUL
# We want to remove routes which are not in the configuration anymore after a signal to reload
self._reconfigure = True
# We want to send all the known routes
self._resend_routes = SEND.DONE
# We have been asked to teardown the session with this code
self._teardown = None
self._delay = Delay()
self.recv_timer = None
def id (self):
return 'peer-%s' % self.neighbor.uid
def _reset (self, message='',error=''):
self.fsm.change(FSM.IDLE)
self.stats = {
'fsm': self.fsm,
'creation': self.stats['creation'],
'reset': time.time(),
'complete': 0,
}
if self.proto:
try:
message = u"peer reset, message [{0}] error[{1}]".format(message, error)
except UnicodeDecodeError as msg_err:
message = u"peer reset, message [{0}] error[{1}]".format(message, msg_err)
self.proto.close(message)
self._delay.increase()
self.proto = None
if not self._restart or self.neighbor.generated:
self.generator = False
return
self.generator = None
self._teardown = None
self.neighbor.rib.reset()
# If we are restarting, and the neighbor definition is different, update the neighbor
if self._neighbor:
self.neighbor = self._neighbor
self._neighbor = None
def _stop (self, message):
self.generator = None
if self.proto:
self.proto.close('stop, message [%s]' % message)
self.proto = None
# logging
def me (self, message):
return "peer %s ASN %-7s %s" % (self.neighbor.peer_address,self.neighbor.peer_as,message)
# control
def stop (self):
self._teardown = 3
self._restart = False
self._restarted = False
self._delay.reset()
self.fsm.change(FSM.IDLE)
self.stats = {
'fsm': self.fsm,
#.........这里部分代码省略.........