diff options
Diffstat (limited to 'cgi/framework.py')
-rw-r--r-- | cgi/framework.py | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/cgi/framework.py b/cgi/framework.py index 5f95303..8c39f81 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -9,6 +9,7 @@ import socket import _mysql import urllib import re +import logging from Cookie import SimpleCookie from settings import Settings @@ -22,7 +23,7 @@ def setBoard(dir): """ if not dir: raise UserError, _("The specified board is invalid.") - logTime("Seteando el board " + dir) + logging.debug("Seteando el board " + dir) board = FetchOne( "SELECT * FROM `boards` WHERE `dir` = '%s' LIMIT 1" % _mysql.escape_string(dir)) if not board: @@ -32,7 +33,6 @@ def setBoard(dir): "SELECT * FROM `boards_filetypes` INNER JOIN `filetypes` ON filetypes.id = boards_filetypes.filetypeid WHERE `boardid` = %s ORDER BY `ext` ASC" % _mysql.escape_string(board['id'])) board["filetypes_ext"] = [filetype['ext'] for filetype in board['filetypes']] - logTime("Board seteado.") Settings._.BOARD = board @@ -474,42 +474,3 @@ def send_mail(subject, srcmsg): s.sendmail(me, [you], msg.as_string()) s.quit() - -class weabotLogger: - def __init__(self): - self.times = [] - - def log(self, message): - self.times.append([time.time(), message]) - - def allTimes(self): - output = "Time Logged action\n--------------------------\n" - start = self.times[0][0] - for time in self.times: - difference = str(time[0] - start) - difference_split = difference.split(".") - if len(difference_split[0]) < 2: - difference_split[0] = "0" + difference_split[0] - - if len(difference_split[1]) < 7: - difference_split[1] = ( - "0" * (7 - len(difference_split[1]))) + difference_split[1] - elif len(difference_split[1]) > 7: - difference_split[1] = difference_split[1][:7] - - output += ".".join(difference_split) + " " + time[1] + "\n" - - return output - - -logger = weabotLogger() - - -def logTime(message): - global logger - logger.log(message) - - -def logTimes(): - global logger - return logger.allTimes() |