aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/config.py
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
committerstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
commit32409110b65b013bc65930f3cfdef09671cd3a5a (patch)
tree4bb6c95c057cdde0f08af78e7abc53e2be02fad4 /onap-client/onap_client/config.py
parent9df81b14e7203d6c3911f5f36881cb5170afdccc (diff)
[VVP] ONAP Client enhancements
Output hooks for resources. Outputs for each resource are returned as part of the complete onap-client spec when a resource is created. Hooks have been added for the SDC resources, to return the TOSCA model for each created resource. Dynamic config change. Ability to specify and reconfigure the onap-client configuration file at runtime without restarting the current session. Logging. Logging has been upgraded to create its own logging instance rather than the root logging instance, to avoid collisions. Issue-ID: VVP-455 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: I7b03411d221801fc51b80ee6a73d9491e823da56
Diffstat (limited to 'onap-client/onap_client/config.py')
-rw-r--r--onap-client/onap_client/config.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/onap-client/onap_client/config.py b/onap-client/onap_client/config.py
index ffe493f..2436619 100644
--- a/onap-client/onap_client/config.py
+++ b/onap-client/onap_client/config.py
@@ -36,7 +36,7 @@
# ============LICENSE_END============================================
import distutils.sysconfig
-import logging as logger
+import logging
import os
import yaml
@@ -70,7 +70,7 @@ class Config:
with open(self.config_file, "r") as f:
config_data = yaml.safe_load(f)
except FileNotFoundError:
- logger.warn(
+ logging.warn(
"Config file {} not found, using default.".format(self.config_file)
)
@@ -96,6 +96,11 @@ APPLICATION_ID = "robot-ete"
CONFIG_ENV = os.environ.get("OC_CONFIG")
CONFIG_FILE = CONFIG_ENV or "/etc/onap_client/config.yaml"
APP_CONFIG = load_config(CONFIG_FILE, "onap_client")
-LOG = logger
-log_level = getattr(LOG, APP_CONFIG.LOG_LEVEL.upper())
-LOG.basicConfig(format="%(asctime)s %(message)s", level=log_level)
+LOG = logging.getLogger("ONAP_CLIENT")
+LOG.propagate = False
+log_level = getattr(logging, APP_CONFIG.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)