Giter Site home page Giter Site logo

django-gitlab-logging's Introduction

Django GitLab Logging

Gitter

Django GitLab Logging is a custom log handler that has been written with the purpose of auto-opening (and assigning) issues on GitLab everytime something goes south with backend code.

Useful for production deployments, where you want to move the flood of 500 errors you get in your mailbox to your GitLab issue tracker.

Django GitLab Logging is smart enough to recognize similar errors, thus not opening blindly a new issue everytime. It is also capable of re-opening closed issues that are encountered again.

Configuration

  • Add gitlab_logging to your INSTALLED_APPS.

  • Drop those lines of configuration in your settings.py, taking care of filling everything:

# GitLab options
GITLAB_HOST = 'https://gitlab.server.tld'  # Beware: no trailing slash there!
GITLAB_USER = 'gitlab.user'
GITLAB_TOKEN = 'USER_GITLAB_TOKEN'         # Get this from GitLab user account information
GITLAB_PROJECT_ID = 114                    # Get the project ID from the DB
GITLAB_ASSIGNEE_ID = 2                     # Get the assignee ID from the DB (optional, you can drop this parameter)
  • Then, ensure you have Celery installed with Django. Django GitLab Logging cannot work without a tasker (here, Celery), since GitLab API calls needs to be done asynchronously to avoid blocking your Web workers in case of network delays or GitLab remote server downtimes.

  • Proceed either a syncdb or a migrate (depending on if you're using South or not)

  • Map the custom GitLab Logging handler:

'handlers': {
    # (....)

    'gitlab_issues': {
        'level': 'ERROR',
        'class': 'gitlab_logging.handlers.GitlabIssuesHandler',
    },
},
  • Activate your GitLab logging handler where you need it:
LOGGING['loggers'] = {
    'django.request': {
        'handlers': ['all_console', 'django_file', 'gitlab_issues'],
        'level': 'DEBUG',
        'propagate': True,
    },

    # (....)
}
  • You're done! โœŒ๏ธ

Notes

  • This module is kept up-to-date with latest GitLab API changes. Thus, ensure you're running the latest GitLab version in time when using Django GitLab Logging!

  • Django GitLab Logging has been built by the happy folks at Waaave.

django-gitlab-logging's People

Contributors

gitter-badger avatar maxwhosevillage avatar valeriansaliou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-gitlab-logging's Issues

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.