Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(565) | Call(565) | Derive(0) | Import(0)
Log a debug message to the main log.
src/b/i/big-brother-bot-HEAD/b3/plugins/sftpytail.py big-brother-bot(Download)
logext = 'games_mp_' + logext + '_' + str(self._port) + '.log' self.lgame_log = os.path.normpath(os.path.expanduser(logext)) self.debug('Local Game Log is %s' % self.lgame_log) if self.console.config.get('server','game_log')[0:7] == 'sftp://' :
self._remoteFileOffset = remoteSize if remoteSize < self._remoteFileOffset: self.debug("remote file rotation detected") self._remoteFileOffset = 0 if remoteSize > self._remoteFileOffset:
#self.debug('RETR from remote offset %s. (expecting to read at least %s bytes)' % (self._remoteFileOffset, remoteSize - self._remoteFileOffset)) if not rfile: self.debug('opening remote game log file %s for reading' % self.sftpconfig['path']) rfile = sftp.open(self.sftpconfig['path'], 'r') rfile.seek(self._remoteFileOffset) self.debug('reading remote game log file from offset %s' % self._remoteFileOffset)
if self.console._paused: self.console.unpause() self.debug('Unpausing') except paramiko.SSHException, e: self.debug(str(e))
src/b/3/b3-1.9.2/b3/plugins/censor.py b3(Download)
# has a regular expression self._badWords.append(self._getCensorData(rulename, regexp.strip(), penalty, self._defaultBadWordPenalty)) self.debug("badword rule '%s' loaded" % rulename) elif word is not None: # has a plain word self._badWords.append(self._getCensorData(rulename, '\\s' + word.strip() + '\\s', penalty, self._defaultBadWordPenalty)) self.debug("badword rule '%s' loaded" % rulename)
# has a regular expression self._badNames.append(self._getCensorData(rulename, regexp.strip(), penalty, self._defaultBadNamePenalty)) self.debug("badname rule '%s' loaded" % rulename) elif word is not None: # has a plain word self._badNames.append(self._getCensorData(rulename, '\\s' + word.strip() + '\\s', penalty, self._defaultBadNamePenalty)) self.debug("badname rule '%s' loaded" % rulename)
def checkBadName(self, client): if not client.connected: self.debug('Client not connected?') return
src/b/i/big-brother-bot-HEAD/b3/plugins/censor.py big-brother-bot(Download)
# has a regular expression self._badWords.append(self._getCensorData(rulename, regexp.strip(), penalty, self._defaultBadWordPenalty)) self.debug("badword rule '%s' loaded" % rulename) elif word is not None: # has a plain word self._badWords.append(self._getCensorData(rulename, '\\s' + word.strip() + '\\s', penalty, self._defaultBadWordPenalty)) self.debug("badword rule '%s' loaded" % rulename)
# has a regular expression self._badNames.append(self._getCensorData(rulename, regexp.strip(), penalty, self._defaultBadNamePenalty)) self.debug("badname rule '%s' loaded" % rulename) elif word is not None: # has a plain word self._badNames.append(self._getCensorData(rulename, '\\s' + word.strip() + '\\s', penalty, self._defaultBadNamePenalty)) self.debug("badname rule '%s' loaded" % rulename)
def checkBadName(self, client): if not client.connected: self.debug('Client not connected?') return
src/b/3/b3-1.9.2/b3/plugins/httpytail.py b3(Download)
else: self.lgame_log = os.path.normpath(os.path.expanduser(self.console.input.name)) self.debug('Local Game Log is %s' % self.lgame_log) if self.console.config.get('server','game_log')[0:7] == 'http://' :
if hasattr(e, 'code'): self.error(str(e.code)) self.debug(str(e)) while self.console.working:
# Detecting log rotation if remote file size is lower than our current cursor position if remoteSize < self._remoteFileOffset: self.debug("remote file rotation detected") self._remoteFileOffset = 0
if hasattr(e, 'code'): self.error(str(e.code)) self.debug(str(e)) except IOError, e: if hasattr(e, 'reason'): self.error('Failed to reach the server. Reason : %s' % str(e.reason)) if hasattr(e, 'code'): self.error('The server could not fulfill the request. Error code : %s' % str(e.code)) self.debug(str(e))
src/b/i/big-brother-bot-HEAD/b3/plugins/httpytail.py big-brother-bot(Download)
else: self.lgame_log = os.path.normpath(os.path.expanduser(self.console.input.name)) self.debug('Local Game Log is %s' % self.lgame_log) if self.console.config.get('server','game_log')[0:7] == 'http://' :
if hasattr(e, 'code'): self.error(str(e.code)) self.debug(str(e)) while self.console.working:
# Detecting log rotation if remote file size is lower than our current cursor position if remoteSize < self._remoteFileOffset: self.debug("remote file rotation detected") self._remoteFileOffset = 0
if hasattr(e, 'code'): self.error(str(e.code)) self.debug(str(e)) except IOError, e: if hasattr(e, 'reason'): self.error('Failed to reach the server. Reason : %s' % str(e.reason)) if hasattr(e, 'code'): self.error('The server could not fulfill the request. Error code : %s' % str(e.code)) self.debug(str(e))
src/b/3/b3-1.9.2/b3/plugins/welcome.py b3(Download)
if self._welcomeDelay < 15 or self._welcomeDelay > 90: self._welcomeDelay = 30 self.debug('Welcome delay not in range 15-90 using 30 instead.') self.info('delay set to %s. The bot will wait %ss after a player connects to write the welcome message' % (self._welcomeDelay, self._welcomeDelay)) except:
return if self.console.upTime() < 300: self.debug('not welcoming player because the bot started less than 5 min ago') return t = threading.Timer(self._welcomeDelay, self.welcome, (event.client,))
def welcome(self, client): _timeDiff = 0 if client.lastVisit: self.debug('LastVisit: %s' %(self.console.formatTime(client.lastVisit))) _timeDiff = time.time() - client.lastVisit else: self.debug('LastVisit not available. Must be the first time.')
else: if _timeDiff <= self._min_gap: self.debug('Client already welcomed in the past %s seconds' % self._min_gap)
src/b/3/b3-1.9.2/b3/plugins/adv.py b3(Download)
self._xlrstatsPlugin = self.console.getPlugin('xlrstats') if not self._xlrstatsPlugin: self.debug('XLRstats not installed, @topstats not available!') else: self.debug('XLRstats found, @topstats available!')
self._feed = None self.warning('Error reading feed at %s' % self._feed) self.debug(f['bozo_exception']) if self._cronTab:
ad = "^2Next map: ^3" + self.console.getNextMap() else: self.debug('Cannot get map rotation') ad = None elif ad == "@time":
self.adv() else: self.debug('Something wrong with the newsfeed, disabling it. Fix the feed and do !advload') self._feed = None return
src/b/i/big-brother-bot-HEAD/b3/plugins/welcome.py big-brother-bot(Download)
if self._welcomeDelay < 15 or self._welcomeDelay > 90: self._welcomeDelay = 30 self.debug('Welcome delay not in range 15-90 using 30 instead.') self.info('delay set to %s. The bot will wait %ss after a player connects to write the welcome message' % (self._welcomeDelay, self._welcomeDelay)) except:
return if self.console.upTime() < 300: self.debug('not welcoming player because the bot started less than 5 min ago') return t = threading.Timer(self._welcomeDelay, self.welcome, (event.client,))
def welcome(self, client): _timeDiff = 0 if client.lastVisit: self.debug('LastVisit: %s' %(self.console.formatTime(client.lastVisit))) _timeDiff = time.time() - client.lastVisit else: self.debug('LastVisit not available. Must be the first time.')
else: if _timeDiff <= self._min_gap: self.debug('Client already welcomed in the past %s seconds' % self._min_gap)
src/b/i/big-brother-bot-HEAD/b3/plugins/adv.py big-brother-bot(Download)
self._xlrstatsPlugin = self.console.getPlugin('xlrstats') if not self._xlrstatsPlugin: self.debug('XLRstats not installed, @topstats not available!') else: self.debug('XLRstats found, @topstats available!')
self._feed = None self.warning('Error reading feed at %s' % self._feed) self.debug(f['bozo_exception']) if self._cronTab:
ad = "^2Next map: ^3" + self.console.getNextMap() else: self.debug('Cannot get map rotation') ad = None elif ad == "@time":
self.adv() else: self.debug('Something wrong with the newsfeed, disabling it. Fix the feed and do !advload') self._feed = None return
src/b/3/b3-1.9.2/b3/plugins/cod7http.py b3(Download)
logext = 'games_mp_' + logext + '_' + str(self._port) + '.log' self.locallog = os.path.normpath(os.path.expanduser(logext)) self.debug('Local Game Log is %s' % self.locallog) if self.console.config.has_option('server', 'log_append'):
self.timeout = int(f.readlines()[0]) f.close() self.debug('Using timeout value of %s seconds' % self.timeout) except (urllib2.HTTPError, urllib2.URLError, socket.timeout), error:
if self.console._paused is False: self.console.pause() self.debug('Pausing') # Remove last line if not complete i = remotelog.rfind ('\r\n')
if self.console._paused: self.console.unpause() self.debug('Unpausing') def processData(self):
output.close() self.lastlines = remotelog[-1000:] self.debug('Downloaded %s KB and added %s char(s) to log' % (remotelogsize, len(newlog))) else:
Previous 1 | 2 | 3 | 4 Next