diff options
author | 2018-01-10 11:27:44 -0500 | |
---|---|---|
committer | 2018-01-11 10:55:32 -0500 | |
commit | 9cbe049d92690f94ca4e07e6a823b90340b922c1 (patch) | |
tree | 0cbfab002f8e55b2394eb8a09d32aaf1d8b8c69c /dcae-policy/tests/log_ctx.py | |
parent | 5ed29250d08b8c5a826f535f48fcfa76c756964a (diff) |
variable collection of policies per component
* new feature variable collection of policies per component in DCAE
* Unit Test coverage 78%
* moved module docstring below the license text
Change-Id: Iefe6d4c31e2e125194781edc79e69af2c11e96ef
Issue-ID: DCAEGEN2-249
Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'dcae-policy/tests/log_ctx.py')
-rw-r--r-- | dcae-policy/tests/log_ctx.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dcae-policy/tests/log_ctx.py b/dcae-policy/tests/log_ctx.py index 9f5464d..9e8ef26 100644 --- a/dcae-policy/tests/log_ctx.py +++ b/dcae-policy/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__) |