diff options
author | Alex Shatov <alexs@att.com> | 2018-01-10 11:39:32 -0500 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2018-01-11 11:05:09 -0500 |
commit | 90f21051fc4347a84a2c079c994e03abbfec5c62 (patch) | |
tree | 1abc4df235d021f4e669cca85ae6a8d14a428d0d /onap-dcae-dcaepolicy-lib/tests/log_ctx.py | |
parent | 21ec33edec7b878ee569981e90e1edda088c2903 (diff) |
variable collection of policies per component
* new feature variable collection of policies per component in DCAE
* massive refactoring
* Unit Test coverage 100%
* moved module docstring below the license text
Change-Id: I5ba392cb5c42ec136306772163c370d64974ae3c
Issue-ID: DCAEGEN2-249
Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'onap-dcae-dcaepolicy-lib/tests/log_ctx.py')
-rw-r--r-- | onap-dcae-dcaepolicy-lib/tests/log_ctx.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/onap-dcae-dcaepolicy-lib/tests/log_ctx.py b/onap-dcae-dcaepolicy-lib/tests/log_ctx.py index 9f5464d..9e8ef26 100644 --- a/onap-dcae-dcaepolicy-lib/tests/log_ctx.py +++ b/onap-dcae-dcaepolicy-lib/tests/log_ctx.py @@ -1,5 +1,3 @@ -""":@CtxLogger.log_ctx: decorator for logging the cloudify ctx before and after operation""" - # org.onap.dcae # ================================================================================ # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. @@ -19,7 +17,10 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. +""":@CtxLogger.log_ctx: decorator for logging the cloudify ctx before and after operation""" + import json +import traceback from functools import wraps from cloudify import ctx @@ -102,7 +103,8 @@ class CtxLogger(object): ctx.logger.info("{0} context: {1}".format(\ func_name, json.dumps(CtxLogger.get_ctx_info()))) except Exception as ex: - ctx.logger.error("Failed to log the node context: {0}".format(str(ex))) + ctx.logger.error("Failed to log the node context: {0}: {1}" \ + .format(str(ex), traceback.format_exc())) @staticmethod def log_ctx(pre_log=True, after_log=False, exe_task=None): @@ -119,8 +121,8 @@ class CtxLogger(object): if ctx.type == NODE_INSTANCE and exe_task: ctx.instance.runtime_properties[exe_task] = func.__name__ except Exception as ex: - ctx.logger.error("Failed to set exe_task {0}: {1}".format(\ - exe_task, str(ex))) + ctx.logger.error("Failed to set exe_task {0}: {1}: {2}" \ + .format(exe_task, str(ex), traceback.format_exc())) if pre_log: CtxLogger.log_ctx_info('before ' + func.__name__) |