From dc90613eba6ee0769d1993db4952a591ec971c9d Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 19 2018 13:20:34 +0000 Subject: print debug and error messages to stderr Fixes: https://pagure.io/koji/issue/671 --- diff --git a/cli/koji b/cli/koji index ab4cdc5..77349f3 100755 --- a/cli/koji +++ b/cli/koji @@ -318,7 +318,7 @@ if __name__ == "__main__": else: exctype, value = sys.exc_info()[:2] rv = 1 - print("%s: %s" % (exctype.__name__, value)) + logger.error("%s: %s" % (exctype.__name__, value)) try: session.logout() except: diff --git a/koji/__init__.py b/koji/__init__.py index 24347bd..c937be7 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2410,12 +2410,12 @@ class ClientSession(object): if timeout: callopts['timeout'] = timeout if self.opts.get('debug_xmlrpc', False): - print("url: %s" % handler) + self.logger.debug("url: %s" % handler) for _key in callopts: _val = callopts[_key] if _key == 'data' and len(_val) > 1024: _val = _val[:1024] + '...' - print("%s: %r" % (_key, _val)) + self.logger.debug("%s: %r" % (_key, _val)) with warnings.catch_warnings(): warnings.simplefilter("ignore") r = self.rsession.post(handler, **callopts) @@ -2430,7 +2430,7 @@ class ClientSession(object): p, u = getparser() for chunk in response.iter_content(8192): if self.opts.get('debug_xmlrpc', False): - print("body: %r" % chunk) + self.logger.debug("body: %r" % chunk) p.feed(chunk) p.close() result = u.close()