Projet

Général

Profil

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

Benjamin Dauvergne, 24 mars 2017 11:55

Télécharger (1,22 ko)

Voir les différences:

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

 wcs/qommon/publisher.py | 9 +++++++++
 1 file changed, 9 insertions(+)
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(
963 972
        if debug:
964 973
            self._app_logger.setLevel(logging.DEBUG)
965 974
        else:
966
-