diff options
Diffstat (limited to 'iceci/decorator/logFuncEntry.py')
-rw-r--r-- | iceci/decorator/logFuncEntry.py | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/iceci/decorator/logFuncEntry.py b/iceci/decorator/logFuncEntry.py deleted file mode 100644 index 3caac92..0000000 --- a/iceci/decorator/logFuncEntry.py +++ /dev/null @@ -1,83 +0,0 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -from services.logging_service import LoggingServiceFactory -logger = LoggingServiceFactory.get_logger() - - -def _aop(decorator): - '''This decorator can be used to turn simple functions - into well-behaved decorators, so long as the decorators - are fairly simple. If a decorator expects a function and - returns a function (no descriptors), and if it doesn't - modify function attributes or docstring, then it is - eligible to use this. Simply apply @_aop to - your decorator and it will automatically preserve the - docstring and function attributes of functions to which - it is applied.''' - def new_decorator(f): - g = decorator(f) - g.__name__ = f.__name__ - g.__doc__ = f.__doc__ - g.__dict__.update(f.__dict__) - return g - - # Now a few lines needed to make _aop itself - # be a well-behaved decorator. - new_decorator.__name__ = decorator.__name__ - new_decorator.__doc__ = decorator.__doc__ - new_decorator.__dict__.update(decorator.__dict__) - return new_decorator - -# -# Sample Use: -# - - -@_aop -def logFuncEntry(func): - def foo(*args, **kwargs): - logger.debug( - 'calling {}'.format( - func.__name__) + - " | " + - str(args) + - " | " + - str(kwargs)) - return func(*args, **kwargs) - return foo |