Skip to content

Instantly share code, notes, and snippets.

@jaydg
Created July 27, 2018 20:21
Show Gist options
  • Save jaydg/bf6973934f91497da838d73957d5adf5 to your computer and use it in GitHub Desktop.
Save jaydg/bf6973934f91497da838d73957d5adf5 to your computer and use it in GitHub Desktop.
django-jinja logging helpers
from django_jinja import library
import logging as log
@library.filter
def debug(msg, *args):
"""
Usage: {{ 'Hello %s' | debug('world') }}
"""
log.debug(msg, *args)
@library.filter
def info(msg, *args):
"""
Usage: {{ 'Hello %s' | info('world') }}
"""
log.info(msg, *args)
@library.filter
def error(msg, *args):
"""
Usage: {{ 'Hello %s' | error('world') }}
"""
log.error(msg, *args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment