view gpp/core/logging.py @ 11:cc8eb028def1

Update jquery-ui and theme version that is hosted on google. In preparation for having jquery on every page (?), make it so that the autocomplete plug is using the 'global' jquery, and not the one that came with it. It seems to work okay with jquery 1.3.2.
author Brian Neal <bgneal@gmail.com>
date Tue, 14 Apr 2009 02:35:35 +0000
parents dbd703f7d63a
children
line wrap: on
line source
'''This module adds a simple logging facility to the portal.
Applications can log information to a database table for debugging.
The logger is similar to the python logging module.
The verbosity of the logging is controlled via settings.GPP_LOG_LEVEL. 
'''

from settings import GPP_LOG_LEVEL
from core.models import DebugLog

DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
CRITICAL = 50

def log(level, msg):
   if GPP_LOG_LEVEL <= level:
      log_item = DebugLog()
      log_item.level = level
      log_item.msg = msg
      log_item.save()

def debug(msg):
   log(DEBUG, msg)

def info(msg):
   log(INFO, msg)

def warning(msg):
   log(WARNING, msg)

def error(msg):
   log(WARNING, msg)

def critical(msg):
   log(WARNING, msg)