From 6c63f2d3c9690b52382e097a6703b816f9ca0e61 Mon Sep 17 00:00:00 2001 From: Kevin Murphy Date: Thu, 25 Jun 2015 15:53:37 -0400 Subject: [PATCH] Alter behavior of debug flag Always log the intended message (use Python logging mechanism to control whether the log message is emitted) Use the debug flag strictly to control whether or not the UDP message is sent. --- src/graphiteudp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/graphiteudp.py b/src/graphiteudp.py index f9372bb..9401a2d 100644 --- a/src/graphiteudp.py +++ b/src/graphiteudp.py @@ -27,9 +27,8 @@ def send(self, metric, value, timestamp = None): if self._prefix is not None: message = self._prefix + "." + message - if self._debug: - logger.debug("%s -> %s" % (repr(message), repr(self._addr))) - else: + logger.debug("%s -> %s" % (repr(message), repr(self._addr))) + if not self._debug: try: (sock, addr) = self._host.get() sock.sendto(message, addr)