File: api_views.py

package info (click to toggle)
python-django-structlog 9.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,004 kB
  • sloc: python: 3,509; sh: 206; javascript: 79; makefile: 19
file content (11 lines) | stat: -rw-r--r-- 301 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
import structlog
from rest_framework.decorators import api_view
from rest_framework.response import Response

logger = structlog.get_logger(__name__)


@api_view()
def home_api_view(request):
    logger.info("This is a rest-framework structured log")
    return Response({"message": "Hello, world!"})