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
This commit is contained in:
committed by
John Griffith
parent
14a5aa045a
commit
b4acbd2586
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user