print debug and error messages to stderr

Fixes: https://pagure.io/koji/issue/671
This commit is contained in:
Tomas Kopecek 2017-12-21 16:46:43 +01:00 committed by Mike McLean
parent 04af97063e
commit 1b07d95ccf
2 changed files with 4 additions and 4 deletions

View file

@ -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:

View file

@ -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()