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 <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/50eeae81
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/50eeae81
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/50eeae81

Branch: refs/heads/object_store
Commit: 50eeae81da0a9d88479ece5e6c0d74449e26cd93
Parents: 4c9ca2b
Author: Prasanna Santhanam <[email protected]>
Authored: Wed May 15 14:51:37 2013 +0530
Committer: Edison Su <[email protected]>
Committed: Wed May 15 19:41:48 2013 -0700

----------------------------------------------------------------------
 tools/marvin/marvin/cloudstackConnection.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/50eeae81/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py 
b/tools/marvin/marvin/cloudstackConnection.py
index 8039117..b5ff5bf 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -20,6 +20,7 @@ import urllib
 import base64
 import hmac
 import hashlib
+import logging
 import time
 import cloudstackException
 from cloudstackAPI import *
@@ -37,6 +38,7 @@ class cloudConnection(object):
                  apiKey=None, securityKey=None,
                  asyncTimeout=3600, logging=None, scheme='http',
                  path='client/api'):
+        self.loglevel() #Turn off requests logs
         self.apiKey = apiKey
         self.securityKey = securityKey
         self.mgtSvr = mgtSvr
@@ -65,6 +67,13 @@ class cloudConnection(object):
                                self.asyncTimeout, self.logging, self.protocol,
                                self.path)
 
+    def loglevel(self, lvl=logging.WARNING):
+        """
+        Turns off the INFO/DEBUG logs from `requests`
+        """
+        requests_log = logging.getLogger("requests")
+        requests_log.setLevel(lvl)
+
     def poll(self, jobid, response):
         """
         polls the completion of a given jobid

Reply via email to