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/cli.py | |
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/cli.py')
-rw-r--r-- | onap-client/onap_client/cli.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/onap-client/onap_client/cli.py b/onap-client/onap_client/cli.py index 24f8b9b..9a58fab 100644 --- a/onap-client/onap_client/cli.py +++ b/onap-client/onap_client/cli.py @@ -36,9 +36,10 @@ # ============LICENSE_END============================================ import json +import logging from prettytable import PrettyTable -from onap_client.client.clients import Client +from onap_client.client.clients import get_client as Client from onap_client.client.catalog import Catalog from onap_client.engine import spec_cli from onap_client.util import utility_cli @@ -51,6 +52,7 @@ def main(*args): keys = None oc = Client() + configure_logging() if len(args) > 0 and args[0] == "spec-engine": # use engine cli instead @@ -213,3 +215,16 @@ def get_catalog_item_data(catalog_item): item["description"] = catalog_item.description return item + + +def configure_logging(): + oc = Client() + LOG_LEVEL = oc.config.LOG_LEVEL if oc.config.LOG_LEVEL else "INFO" + + LOG = logging.getLogger() + log_level = getattr(logging, LOG_LEVEL.upper()) + ch = logging.StreamHandler() + LOG.setLevel(log_level) + formatter = logging.Formatter('%(levelname)s %(asctime)s %(name)s %(message)s') + ch.setFormatter(formatter) + LOG.addHandler(ch) |