Skip to content

Commit b17be94

Browse files
author
Prasanna Santhanam
committed
don't let requests logs
requests logs to the logger making it hard to distinguish marvin logs from http logs. Signed-off-by: Prasanna Santhanam <tsp@apache.org>
1 parent 24cdddb commit b17be94

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tools/marvin/marvin/cloudstackConnection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import base64
2121
import hmac
2222
import hashlib
23+
import logging
2324
import time
2425
import cloudstackException
2526
from cloudstackAPI import *
@@ -37,6 +38,7 @@ def __init__(self, mgtSvr, port=8096, user=None, passwd=None,
3738
apiKey=None, securityKey=None,
3839
asyncTimeout=3600, logging=None, scheme='http',
3940
path='client/api'):
41+
self.loglevel() #Turn off requests logs
4042
self.apiKey = apiKey
4143
self.securityKey = securityKey
4244
self.mgtSvr = mgtSvr
@@ -65,6 +67,13 @@ def __copy__(self):
6567
self.asyncTimeout, self.logging, self.protocol,
6668
self.path)
6769

70+
def loglevel(self, lvl=logging.WARNING):
71+
"""
72+
Turns off the INFO/DEBUG logs from `requests`
73+
"""
74+
requests_log = logging.getLogger("requests")
75+
requests_log.setLevel(lvl)
76+
6877
def poll(self, jobid, response):
6978
"""
7079
polls the completion of a given jobid

0 commit comments

Comments
 (0)