Added log.timestamp.

This commit is contained in:
Jeremy Fincher 2004-01-19 20:22:06 +00:00
parent 6950f65c98
commit dc87ed26aa
4 changed files with 12 additions and 9 deletions

View File

@ -73,11 +73,9 @@ class AsyncoreDriver(asynchat.async_chat, object):
self.close()
def scheduleReconnect(self):
when = time.time() + 60
whenS = time.strftime(conf.supybot.log.timestampFormat(),
time.localtime(when))
when = log.timestamp(time.time()+60)
if not world.dying:
log.info('Scheduling reconnect to %s at %s', self.server, whenS)
log.info('Scheduling reconnect to %s at %s', self.server, when)
def makeNewDriver():
self.irc.reset()
driver = self.__class__(self.server, self.irc)

View File

@ -35,6 +35,7 @@ import fix
import os
import sys
import time
import cgitb
import types
import atexit
@ -228,6 +229,12 @@ def getPluginLogger(name):
log.addHandler(handler)
return log
def timestamp(when=None):
if when is None:
when = time.time()
format = conf.supybot.log.timestampFormat()
return time.strftime(format, time.localtime(when))
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -152,10 +152,9 @@ class SocketDriver(drivers.IrcDriver):
def _scheduleReconnect(self):
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
whenS = time.strftime(conf.supybot.log.timestampFormat(),
time.localtime(when))
when = log.timestamp(when)
if not world.dying:
log.info('Scheduling reconnect to %s at %s', self.server, whenS)
log.info('Scheduling reconnect to %s at %s', self.server, when)
schedule.addEvent(self.reconnect, when)
def name(self):

View File

@ -92,8 +92,7 @@ def upkeep():
log.debug('Pattern cache size: %s'%len(ircutils._patternCache))
log.debug('HostmaskPatternEqual cache size: %s' %
len(ircutils._hostmaskPatternEqualCache))
log.info('%s upkeep ran.',
time.strftime(conf.supybot.log.timestampFormat()))
log.info('%s upkeep ran.', log.timestamp())
return collected
def makeDriversDie():