summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2014-04-04 15:15:44 +1000
committerJohn Griffith <john.griffith8@gmail.com>2014-07-29 12:26:33 -0600
commitb4acbd2586a2b6f43ac51779e4f958862753d2ed (patch)
treedbcb5a315832e6af3f30e03ea5b53c6299ade013
parent14a5aa045a391a900e34a5341b07b71ac973cf77 (diff)
downloadpython-cinderclient-b4acbd2586a2b6f43ac51779e4f958862753d2ed.tar.gz
Move debug logging to shell
Adding channels to a logger is not the responsibility of a library. This sort of thing should be handled by an application so move the logging over to the shell. Change-Id: Ie11571d428913eba1aae5aa42a6e925228ba6808
-rw-r--r--cinderclient/client.py6
-rw-r--r--cinderclient/shell.py9
2 files changed, 9 insertions, 6 deletions
diff --git a/cinderclient/client.py b/cinderclient/client.py
index 3145324..fe20a6d 100644
--- a/cinderclient/client.py
+++ b/cinderclient/client.py
@@ -212,12 +212,6 @@ class HTTPClient(CinderClientMixin):
self.auth_plugin = auth_plugin
self._logger = logging.getLogger(__name__)
- if self.http_log_debug and not self._logger.handlers:
- ch = logging.StreamHandler()
- self._logger.setLevel(logging.DEBUG)
- self._logger.addHandler(ch)
- if hasattr(requests, 'logging'):
- requests.logging.getLogger(requests.__name__).addHandler(ch)
def http_log_req(self, args, kwargs):
if not self.http_log_debug:
diff --git a/cinderclient/shell.py b/cinderclient/shell.py
index af166a0..83242f3 100644
--- a/cinderclient/shell.py
+++ b/cinderclient/shell.py
@@ -29,6 +29,8 @@ import os
import pkgutil
import sys
+import requests
+
from cinderclient import client
from cinderclient import exceptions as exc
from cinderclient import utils
@@ -478,6 +480,13 @@ class OpenStackCinderShell(object):
logger.setLevel(logging.WARNING)
logger.addHandler(streamhandler)
+ client_logger = logging.getLogger(client.__name__)
+ ch = logging.StreamHandler()
+ client_logger.setLevel(logging.DEBUG)
+ client_logger.addHandler(ch)
+ if hasattr(requests, 'logging'):
+ requests.logging.getLogger(requests.__name__).addHandler(ch)
+
def main(self, argv):
# Parse args once to find version and debug settings