diff options
Diffstat (limited to 'cgi/weabot.py')
| -rwxr-xr-x | cgi/weabot.py | 15 | 
1 files changed, 6 insertions, 9 deletions
diff --git a/cgi/weabot.py b/cgi/weabot.py index 3c5d0f5..ff93118 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -8,6 +8,7 @@ import time  import datetime  import random  import cgi +import logging  import _mysql  from Cookie import SimpleCookie @@ -33,6 +34,9 @@ _LOG = False  class weabot(object):      def __init__(self, environ, start_response):          global _DEBUG + +        logging.basicConfig(filename='weabot.log', format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG) +          self.environ = environ          if self.environ["PATH_INFO"].startswith("/weabot.py/"):              self.environ["PATH_INFO"] = self.environ["PATH_INFO"][11:] @@ -48,7 +52,6 @@ class weabot(object):              'weabot', './locale', languages=[Settings.LANG])          lang.install() -        logTime("**Start**")          if _DEBUG:              import cProfile @@ -70,12 +73,6 @@ class weabot(object):          # close database and finish          CloseDb() -        logTime("**End**") - -        if _LOG: -            logfile = open(Settings.ROOT_DIR + "weabot.txt", "w") -            logfile.write(logTimes()) -            logfile.close()      def __iter__(self):          self.handleResponse() @@ -812,7 +809,7 @@ class weabot(object):                  post["message"]), _mysql.escape_string(board["id"]), _mysql.escape_string(str(postid))))          # do operations if replying to a thread (bump, autoclose, update cache) -        logTime("Updating thread") +        logging.debug("Updating thread")          thread_length = None          if post["parentid"]:              # get length of the thread @@ -1086,7 +1083,7 @@ if __name__ == "__main__":      # Psyco is not required, however it will be used if available      try:          import psyco -        logTime("Psyco se ha instalado") +        logging.debug("Psyco se ha instalado")          psyco.bind(tenjin.helpers.to_str)          psyco.bind(weabot.run, 2)          psyco.bind(getFormData)  | 
