Login

logging to shell on dev server

Author:
chachan
Posted:
July 15, 2012
Language:
Python
Version:
Not specified
Score:
1 (after 1 ratings)

You can customize the format. Also you can display variable values that support str or another object-to-string method.

1
2
3
4
5
6
7
8
9
from django.shortcuts import render
import logging

logging_format = '%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s'
logging.basicConfig(level=logging.DEBUG, format=logging_format)

def some_view(request):
    logging.debug('This is a debugging message')
    return render(request, 'some_template.html', {})

More like this

  1. Browser-native date input field by kytta 4 weeks, 1 day ago
  2. Generate and render HTML Table by LLyaudet 1 month, 1 week ago
  3. My firs Snippets by GutemaG 1 month, 1 week ago
  4. FileField having auto upload_to path by junaidmgithub 2 months, 2 weeks ago
  5. LazyPrimaryKeyRelatedField by LLyaudet 2 months, 3 weeks ago

Comments

Please login first before commenting.