diff options
author | stark, steven <steven.stark@att.com> | 2020-08-17 13:00:47 -0700 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2020-08-19 13:52:20 -0700 |
commit | 7c90d325e8fd8ce21fa747ab292f9c233e3bf367 (patch) | |
tree | 6857c930b3c558a6bb52b33ade86efc20581589f /onap-client/onap_client/client | |
parent | 6b5ef9b8b18f46358e699686a6e706ed3002bd9a (diff) |
[VVP] Updating logging
Updating logging to inherit logging instacne from
calling application. CLI creates own logging instance.
Issue-ID: VVP-456
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: I1277eb55413063e90b1681b36881a6a5a2b9c272
Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'onap-client/onap_client/client')
-rw-r--r-- | onap-client/onap_client/client/clients.py | 11 | ||||
-rw-r--r-- | onap-client/onap_client/client/request.py | 7 | ||||
-rw-r--r-- | onap-client/onap_client/client/response.py | 4 |
3 files changed, 6 insertions, 16 deletions
diff --git a/onap-client/onap_client/client/clients.py b/onap-client/onap_client/client/clients.py index f0a0c1d..8a8160f 100644 --- a/onap-client/onap_client/client/clients.py +++ b/onap-client/onap_client/client/clients.py @@ -36,11 +36,11 @@ # ============LICENSE_END============================================ import importlib +import logging import onap_client import pkgutil import inspect import sys -import logging from onap_client.client.catalog import Catalog from onap_client import config @@ -66,7 +66,7 @@ class Client(Catalog): super().__init__() if config_file: - config.LOG.info("Overriding ONAP Client configuration: {}".format(config_file)) + logging.info("Overriding ONAP Client configuration: {}".format(config_file)) self.set_config(config_file) @property @@ -90,18 +90,13 @@ class Client(Catalog): def set_config(self, config_file): self.config = config.load_config(config_file, "onap_client") - self._set_logging(self.config.LOG_LEVEL) for attr_name, attr in self.__dict__.items(): if isinstance(attr, Client): - config.LOG.info("Reloading {} {}".format(attr_name, attr)) + logging.info("Reloading {} {}".format(attr_name, attr)) attr.set_config(config_file) for k, v in attr.catalog_resources.items(): attr.load(k, v) - def _set_logging(self, level): - LOG = logging.getLogger("ONAP_CLIENT") - LOG.setLevel(getattr(logging, level.upper())) - def import_submodules(package, recursive=True): """Import all the modules in onap-client, except for those starting diff --git a/onap-client/onap_client/client/request.py b/onap-client/onap_client/client/request.py index 194dad5..268ee98 100644 --- a/onap-client/onap_client/client/request.py +++ b/onap-client/onap_client/client/request.py @@ -40,14 +40,12 @@ import requests import json import os import copy -import logging +import logging as logger from onap_client.client.response import ResponseHandler from onap_client.exceptions import FilesRequestFailure from jinja2 import exceptions as jinja_exceptions -logger = logging.getLogger("ONAP_CLIENT") - class RequestHandler: """Handles a APICatalogRequestObject to make a request @@ -62,7 +60,7 @@ class RequestHandler: def make_request(self): r = Request(self.request_object) - logger.warning("Submitting request: {}".format(self.request_object.description)) + logger.info("Submitting request: {}".format(self.request_object.description)) # TODO # Add verify to config file return ResponseHandler(r.request(verify=False), self.request_object) @@ -110,7 +108,6 @@ class Request: try: logger.info(json.dumps(debug_request, indent=4)) - # logger.info(debug_request) except TypeError: logger.info(debug_request) diff --git a/onap-client/onap_client/client/response.py b/onap-client/onap_client/client/response.py index 307ed1b..d9c6a84 100644 --- a/onap-client/onap_client/client/response.py +++ b/onap-client/onap_client/client/response.py @@ -36,9 +36,7 @@ # ============LICENSE_END============================================ import simplejson -import logging - -logger = logging.getLogger("ONAP_CLIENT") +import logging as logger class ResponseHandler: |