Projet

Général

Profil

0002-add-a-graypy-handler-if-GRAYLOG_URL-exists-10411.patch

Benjamin Dauvergne, 27 mars 2017 11:37

Télécharger (1,94 ko)

Voir les différences:

Subject: [PATCH 2/2] add a graypy handler if GRAYLOG_URL exists (#10411)

 debian/control          | 2 +-
 wcs/qommon/publisher.py | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
debian/control
9 9

  
10 10
Package: wcs
11 11
Architecture: all
12
Depends: ${python:Depends}, python-quixote, python-scgi, graphviz, python-feedparser, python-imaging
12
Depends: ${python:Depends}, python-quixote, python-scgi, graphviz, python-feedparser, python-imaging, python-graypy
13 13
Recommends: python-dns, python-xlwt, python-qrcode, libjs-leaflet, python-magic
14 14
Suggests: libapache2-mod-scgi | libapache-mod-scgi, python-libxml2, python-lasso, python-psycopg2
15 15
Description: web application to design and set up online forms
wcs/qommon/publisher.py
58 58
import urllib
59 59

  
60 60
from qommon import _
61
try:
62
    import graypy
63
except ImportError:
64
    graypy = None
65

  
61 66

  
62 67
class ImmediateRedirectException(Exception):
63 68
    def __init__(self, location):
......
960 965
                    '%(session_id)s %(path)s %(user_id)s - %(message)s')
961 966
            hdlr.setFormatter(formatter)
962 967
            self._app_logger.addHandler(hdlr)
968
            if os.environ.get('GRAYLOG_URL') and graypy:
969
                host = os.environ['GRAYLOG_URL'].split(':', 1)[0]
970
                port = int(os.environ['GRAYLOG_URL'].split(':', 1)[0])
971
                hdlr = graypy.GELFHandler(fqdn=True, host=host, port=port)
963 972
        if debug:
964 973
            self._app_logger.setLevel(logging.DEBUG)
965 974
        else:
966
-