From c55d4df1d30a4d09d0abf476330d61a67814cdaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20K=C3=A1cha?= <ph@cesnet.cz> Date: Tue, 3 Feb 2015 09:52:13 +0100 Subject: [PATCH] Client now logs only if there is something to log --- warden3/warden_client/warden_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py index 297d2fa..6a807fc 100644 --- a/warden3/warden_client/warden_client.py +++ b/warden3/warden_client/warden_client.py @@ -8,7 +8,6 @@ import json, httplib, ssl, socket, logging, logging.handlers from urlparse import urlparse from urllib import urlencode from sys import stderr, exc_info -from UserList import UserList from pprint import pformat from traceback import format_tb from os import path @@ -69,8 +68,12 @@ class Error(Exception): self.cause = self.excval # compatibility with other exceptions if logger: getattr(logger, prio, "error")(str(self)) - logger.info(self.info_str()) - logger.debug(self.debug_str()) + info = self.info_str() + if info: + logger.info(info) + debug = self.debug_str() + if debug: + logger.debug(debug) def __len__ (self): -- GitLab