本文整理汇总了Python中dtella.common.log.LOG.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.info方法的具体用法?Python LOG.info怎么用?Python LOG.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtella.common.log.LOG
的用法示例。
在下文中一共展示了LOG.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handleCmd_ENDBURST
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def handleCmd_ENDBURST(self, prefix, args):
if self.ism.syncd:
# FIXME
LOG.warning("Ignoring ENDBURST")
return
CHECK(self.server_name)
LOG.info("Finished receiving IRC sync data.")
self.showirc = True
# Check for conflicting bridges.
if self.ism.findConflictingBridge():
LOG.error("My nick prefix is in use! Terminating.")
self.transport.loseConnection()
reactor.stop()
return
# Set up nick reservation
scfg = getServiceConfig()
self.ism.killConflictingUsers()
self.sendLine(
":%s ADDLINE Q %s* %s %d 0 :%s" %
(self.sid, cfg.dc_to_irc_prefix, scfg.my_host,
time.time(), self.qline_reason))
# Send my own bridge nick
self.pushBotJoin(do_nick=True)
# When we enter the syncd state, register this instance with Dtella.
# This will eventually trigger event_DtellaUp, where we send our state.
self.schedulePing()
self.ism.addMeToMain()
示例2: handleCmd_SERVER
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def handleCmd_SERVER(self, prefix, args):
if prefix:
# Not from our connected server
return
if self.server_name:
# Could be a dupe? Ignore it.
return
# We got a reply from the our connected IRC server, so our password
# was just accepted. Send the Dtella state information into IRC.
# Save server name
CHECK(args[0])
self.server_name = args[0]
LOG.info("IRC Server Name: %s" % self.server_name)
# Tell the ReconnectingClientFactory that we're cool
self.factory.resetDelay()
# This isn't very correct, because the Dtella nicks
# haven't been sent yet, but it's the best we can practically do.
scfg = getServiceConfig()
cloak_checksum = scfg.hostmasker.getChecksum()
self.sendLine("NETINFO 0 %d 0 %s 0 0 0 :%s" %
(time.time(), cloak_checksum, scfg.network_name))
self.sendLine(":%s EOS" % scfg.my_host)
示例3: handleCmd_PING
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def handleCmd_PING(self, prefix, args):
LOG.info("PING? PONG!")
scfg = getServiceConfig()
if len(args) == 1:
self.sendLine("PONG %s :%s" % (scfg.my_host, args[0]))
elif len(args) == 2:
self.sendLine("PONG %s :%s" % (args[1], args[0]))
示例4: connectionLost
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def connectionLost(self, result):
LOG.info("Lost IRC connection.")
if self.ism.syncd:
self.ism.removeMeFromMain()
if self.shutdown_deferred:
self.shutdown_deferred.callback("Bye!")
示例5: handleCmd_EOS
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def handleCmd_EOS(self, prefix, args):
if prefix != self.server_name:
return
if self.ism.syncd:
return
LOG.info("Finished receiving IRC sync data.")
self.showirc = True
# Check for conflicting bridges.
if self.ism.findConflictingBridge():
LOG.error("My nick prefix is in use! Terminating.")
self.transport.loseConnection()
reactor.stop()
return
# Set up nick reservation
scfg = getServiceConfig()
self.sendLine(
"TKL + Q * %s* %s 0 %d :Reserved for Dtella" %
(cfg.dc_to_irc_prefix, scfg.my_host, time.time()))
self.ism.killConflictingUsers()
# Send my own bridge nick
self.pushBotJoin(do_nick=True)
# When we enter the syncd state, register this instance with Dtella.
# This will eventually trigger event_DtellaUp, where we send our state.
self.schedulePing()
self.ism.addMeToMain()
示例6: connectionMade
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def connectionMade(self):
scfg = getServiceConfig()
LOG.info("Connected to IRC server.")
self.challenge = make_challenge()
my_capabs = [
("NICKMAX", 32),
("HALFOP", 1),
("CHANMAX", 65),
("MAXMODES", 20),
("IDENTMAX", 12),
("MAXQUIT", 255),
("MAXTOPIC", 307),
("MAXKICK", 255),
("MAXGECOS", 128),
("MAXAWAY", 200),
("IP6SUPPORT", 1),
("PROTOCOL", 1201),
("CHALLENGE", self.challenge),
]
my_capabs_str = ' '.join("%s=%s" % x for x in my_capabs)
self.sendLine("CAPAB START")
self.sendLine("CAPAB CAPABILITIES :%s" % my_capabs_str)
self.sendLine("CAPAB END")
示例7: cleanupOnExit
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def cleanupOnExit(self):
LOG.info("Reactor is shutting down. Doing cleanup.")
self.shutdown(reconnect='no')
self.state.saveState()
# Cleanly close the IRC connection before terminating
if self.ism:
return self.ism.shutdown()
示例8: killConflictingUsers
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def killConflictingUsers(self):
# Find any reserved nicks, and KILL them.
CHECK(self.ircs and not self.syncd)
bad_users = [u for u in set(self.users.itervalues())
if matches_dc_to_irc_prefix(u.inick)]
LOG.info("Conflicting users: %r" % bad_users)
for u in bad_users:
self.ircs.event_KillUser(u)
self.removeUser(u)
示例9: removeQLine
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def removeQLine(self, nickmask):
self.qlines.pop(nickmask, None)
LOG.info("Removed Q-line: " + nickmask)
# If some other bridge removes our reservation, abort.
if self.syncd and (nickmask == cfg.dc_to_irc_prefix + "*"):
LOG.error("My own Q-line was removed! Terminating.")
if self.ircs:
self.ircs.transport.loseConnection()
reactor.stop()
示例10: addQLine
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def addQLine(self, nickmask, reason):
nick_re = wild_to_regex(nickmask)
# After EOS, auto-remove any Q-lines which conflict with mine.
# This may cause a conflicting bridge to abort.
if self.syncd and nick_re.match(cfg.dc_to_irc_prefix):
if self.ircs:
self.ircs.pushRemoveQLine(nickmask)
LOG.info("Conflicted Q-line: " + nickmask)
return
self.qlines[nickmask] = (nick_re, reason)
LOG.info("Added Q-line: " + nickmask)
示例11: runClient
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def runClient(dc_port):
#Logging for Dtella Client
setLogFile("dtella.log", 1<<20, 1)
LOG.debug("Client Logging Manager Initialized")
from dtella.client.main import DtellaMain_Client
dtMain = DtellaMain_Client()
import dtella.local_config as local
from dtella.common.util import get_version_string
def botErrorReporter(text):
dch = dtMain.dch
if dch:
dch.bot.say(
"Something bad happened. You might want to email this to "
"[email protected] so we'll know about it:\n"
"Version: %s %s\n%s" %
(local.hub_name, get_version_string()[3:], text))
addTwistedErrorCatcher(botErrorReporter)
addTwistedErrorCatcher(LOG.critical)
from dtella.client.dc import DCFactory
dfactory = DCFactory(dtMain, dc_port)
LOG.info("%s %s" % (local.hub_name, local.version))
def cb(first):
try:
reactor.listenTCP(dc_port, dfactory, interface='127.0.0.1')
except twisted.internet.error.CannotListenError:
if first:
LOG.warning("TCP bind failed. Killing old process...")
if terminate(dc_port):
LOG.info("Ok. Sleeping...")
reactor.callLater(2.0, cb, False)
else:
LOG.error("Kill failed. Giving up.")
reactor.stop()
else:
LOG.error("Bind failed again. Giving up.")
reactor.stop()
else:
LOG.info("Listening on 127.0.0.1:%d" % dc_port)
dtMain.startConnecting()
reactor.callWhenRunning(cb, True)
reactor.run()
示例12: event_DtellaUp
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def event_DtellaUp(self):
osm = self.getOnlineStateManager()
LOG.info("Sending Dtella state to IRC...")
nicks = osm.nkm.nickmap.values()
nicks.sort(key=lambda n: n.nick)
for n in nicks:
try:
# This event does everything we need.
self.event_AddNick(n)
except NickError:
osm.nkm.removeNode(n, "Bad Nick")
n.setNoUser()
示例13: cb
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def cb(first):
try:
reactor.listenTCP(dc_port, dfactory, interface='127.0.0.1')
except twisted.internet.error.CannotListenError:
if first:
LOG.warning("TCP bind failed. Killing old process...")
if terminate(dc_port):
LOG.info("Ok. Sleeping...")
reactor.callLater(2.0, cb, False)
else:
LOG.error("Kill failed. Giving up.")
reactor.stop()
else:
LOG.error("Bind failed again. Giving up.")
reactor.stop()
else:
LOG.info("Listening on 127.0.0.1:%d" % dc_port)
dtMain.startConnecting()
示例14: handleCmd_SQUIT
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def handleCmd_SQUIT(self, prefix, args):
# :n.dhirc.com SQUIT remote.dtella.org :Remote host closed
hostname = args[0]
try:
# All servers have been registered as users.
sid = self.ism.findUser(hostname).uuid.lower()
if len(sid) != 3:
raise KeyError
except KeyError:
LOG.error("SQUIT: unknown server: %s" % hostname)
return
# Find all the users belonging to this server. This should
# never match nicks, because only UUIDs start with a number.
remove_uuids = [uuid for uuid in self.ism.users
if uuid.startswith(sid)]
# Drop them off the network.
for uuid in remove_uuids:
LOG.info("SQUIT: removing user: %s" % uuid)
self.ism.removeUser(self.ism.findUser(uuid))
示例15: findConflictingBridge
# 需要导入模块: from dtella.common.log import LOG [as 别名]
# 或者: from dtella.common.log.LOG import info [as 别名]
def findConflictingBridge(self):
# Determine if another bridge conflicts with me.
# Return True if we need to abort.
CHECK(self.ircs and not self.syncd)
stale_qlines = []
for nickmask, (q, reason) in self.qlines.iteritems():
# Look for Q-lines which conflict with my prefix.
if not q.match(cfg.dc_to_irc_prefix):
continue
LOG.info("Found a conflicting Q-line: %s" % nickmask)
# If any nicks exist under that Q-line, we'll need to abort.
for u in set(self.users.itervalues()):
if q.match(u.inick):
LOG.info("... and a nick to go with it: %s" % u.inick)
return True
stale_qlines.append(nickmask)
# Remove all stale Q-lines from the network.
LOG.info("Stale qlines: %r" % stale_qlines)
for nickmask in stale_qlines:
del self.qlines[nickmask]
self.ircs.pushRemoveQLine(nickmask)
# Conflict has been neutralized.
return False