def log_write(m): if stopped: return logname = "%s_%s" % (m.botname, stripname(m.target)) timestamp = timestr(m.datetime) m.type = m.type.upper() line = '%(timestamp)s%(separator)s <%(nick)s %(txt)s\n'%({ 'timestamp': timestamp, 'separator': format_opt('separator'), 'nick': m.nick, 'txt': m.txt, 'nick': m.nick, 'type': m.type }) global loggers try: loggers[logname].info(line.strip()) except KeyError: logging.warn("no logger available for channel %s" % logname) except Exception, ex: handle_exception()
def log_write(m): if stopped: return logname = "%s_%s" % (m.botname, stripname(m.target)) if logname not in loggers: return timestamp = timestr(m.datetime) m.type = m.type.upper() line = '%(timestamp)s%(separator)s %(txt)s\n'%({ 'timestamp': timestamp, 'separator': format_opt('separator'), 'nick': m.nick, 'txt': m.txt, 'nick': m.nick, 'type': m.type }) try: loggers[logname].info(line.strip()) except KeyError: logging.error("no logger available for channel %s" % logname) except Exception, ex: handle_exception()
def log_write(m): if stopped: return logname = "%s_%s" % (m.botname, stripname(m.target)) timestamp = timestr(m.datetime) m.type = m.type.upper() line = '%(timestamp)s%(separator)s%(txt)s\n' % ( { 'timestamp': timestamp, 'separator': format_opt('separator'), 'txt': m.txt, 'type': m.type }) global loggers try: loggers[logname].info(line.strip()) #logging.debug("chatlog - logged %s - %s" % (logname, line.strip())) except KeyError: logging.warn("no logger available for channel %s" % logname) except Exception, ex: handle_exception()
def timestr(dt): return dt.strftime(format_opt('timestamp_format'))
def timestr(dt): """ convert datatime object to a time string. """ return dt.strftime(format_opt('timestamp_format'))