Created
July 27, 2018 20:21
-
-
Save jaydg/bf6973934f91497da838d73957d5adf5 to your computer and use it in GitHub Desktop.
django-jinja logging helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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