summaryrefslogtreecommitdiffstats
path: root/pylog/onaplogging/monkey.py
diff options
context:
space:
mode:
authorEli Halych <illia.halych@t-mobile.pl>2020-09-02 13:10:35 +0000
committerEli Halych <illia.halych@t-mobile.pl>2020-09-07 08:52:24 +0000
commit7035aed700a463fd171807526475baf84c1434e7 (patch)
tree9d0e7c4c8252f431ac3e12c0f5086c1c8b625f79 /pylog/onaplogging/monkey.py
parent314ee85cf7c8a98dd21d5d12e4013b9f742b1012 (diff)
onaplogging: Docstrings, refactor, type hinting
Identify and document functionalities. Describe parameters and their types, exception descriptions and types, extensions, return types and descriptions. Preserve Python 2.7 and 3.x compatibility. Add Python 2.7 to Tox testing. Extract code to utility files. Add properties for readability and maintainability, fix naming conventions. Deprecate old methods and attributes. Issue-ID: REQ-420 Signed-off-by: Eli Halych <illia.halych@t-mobile.pl> Change-Id: I19297e40fad743ec68aa04612ecbb11f61f2abec
Diffstat (limited to 'pylog/onaplogging/monkey.py')
-rw-r--r--pylog/onaplogging/monkey.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/pylog/onaplogging/monkey.py b/pylog/onaplogging/monkey.py
index f8bf992..33c3ced 100644
--- a/pylog/onaplogging/monkey.py
+++ b/pylog/onaplogging/monkey.py
@@ -12,17 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from .mdcContext import patch_loggingMDC
-from .logWatchDog import patch_loggingYaml
+from typing import Optional
+
+from .mdcContext import patch_logging_mdc
+from .logWatchDog import patch_logging_yaml
__all__ = ["patch_all"]
def patch_all(mdc=True, yaml=True):
+ # type: ( Optional[bool], Optional[bool] ) -> None
+ """
+ Patches both MDC contextual information and YAML configuration file to the
+ logger by default. To exclude any or both set `mdc` and/or `yaml`
+ parameters to False.
+
+ Args:
+ mdc (bool, optional): Defaults to True.
+ yaml (bool, optional): Defaults to True.
+ """
if mdc is True:
- patch_loggingMDC()
+ patch_logging_mdc()
if yaml is True:
- patch_loggingYaml()
+ patch_logging_yaml()