log all tags starting with error- at the error level, add a warning level handling

This commit is contained in:
Benjamin Dauvergne 2013-07-30 10:06:47 +02:00
parent bb40b01d42
commit 3aa73f2c35
1 changed files with 3 additions and 1 deletions

View File

@ -39,8 +39,10 @@ def record(tag, template, using=None, **kwargs):
'Missing variable for the template message', template, e)
try:
logger = logging.getLogger('django.journal.%s' % tag)
if tag.name == 'error':
if tag.name == 'error' or tag.name.startswith('error-'):
logger.error(message)
elif tag.name == 'warning' or tag.name.startswith('warning-'):
logger.warning(message)
else:
logger.info(message)
except: