From 1b07d95ccfad6e7d10c84f48d882f41179f8705b Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Thu, 21 Dec 2017 16:46:43 +0100 Subject: [PATCH] print debug and error messages to stderr Fixes: https://pagure.io/koji/issue/671 --- cli/koji | 2 +- koji/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/koji b/cli/koji index ab4cdc5c..77349f37 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 039ef1a9..fd6836d4 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2411,12 +2411,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) @@ -2431,7 +2431,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()