Giter Site home page Giter Site logo

django-error-logs's Introduction

Error Logger for Django Rest Framework

Error logging for DRF projects: log occuring errors, group them by endpoint, and reconstruct them without effort.

Catches all Exceptions except django.http.Http404 and rest_framework.exceptions.ValidationError, and logs them. You can then get the requests that caused errors: all, one per group or all not yet resolved ones.

Installation

  1. Clone this project into your Django project
  2. Add logger to your installed apps in setting.py
  3. Add logger.core.LoggingMiddleware to your middleware in settings.py
  4. python manage.py migrate

Use

Where to find logs?

You have an overview over all errors in the django admin site, and logger provides a view in its subpath /list with overview over all errors. You can define if you see all errors or only one (if possible, unresolved) error per group, by putting this into your settings:

LOGGER = {
    "one_per_group": True
}

Not sure what the default behaviour is.

preview

You can add one of these to your tests:

Use logged errors as tests

Call one of these in your tests to get errors

errors = logger.core.get_one_error_per_group()
errors = logger.core.get_all_errors()
errors = logger.core.get_all_unresolved()

And then

for error in errors:
	succes, msg = logger.core.run_error(error)
	...	

Missing features

  • Requests with files: files are not saved
  • Auto generate test cases

django-error-logs's People

Contributors

nielsrolf avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.