aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/configuration/settings.py32
-rw-r--r--src/onaptests/steps/base.py18
2 files changed, 49 insertions, 1 deletions
diff --git a/src/onaptests/configuration/settings.py b/src/onaptests/configuration/settings.py
index f6959de..0e69b4e 100644
--- a/src/onaptests/configuration/settings.py
+++ b/src/onaptests/configuration/settings.py
@@ -6,6 +6,38 @@
# #
######################
+
+# Variables to set logger information
+# Possible values for logging levels in onapsdk: INFO, DEBUG , WARNING, ERROR
+LOG_CONFIG = {
+ "version": 1,
+ "disable_existing_loggers": False,
+ "formatters": {
+ "default": {
+ "class": "logging.Formatter",
+ "format": "%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s"
+ }
+ },
+ "handlers": {
+ "console": {
+ "level": "DEBUG",
+ "class": "logging.StreamHandler",
+ "formatter": "default"
+ },
+ "file": {
+ "level": "DEBUG",
+ "class": "logging.FileHandler",
+ "formatter": "default",
+ "filename": "./pythonsdk.debug.log",
+ "mode": "w"
+ }
+ },
+ "root": {
+ "level": "DEBUG",
+ "handlers": ["console", "file"]
+ }
+}
+
VENDOR_NAME = "sdktests_vendor"
VSP_NAME = "sdktests_vsp"
VSP_FILE_PATH = "vfw.zip"
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py
index b32e6d3..5f66935 100644
--- a/src/onaptests/steps/base.py
+++ b/src/onaptests/steps/base.py
@@ -1,10 +1,24 @@
+import logging
+import logging.config
+
from abc import ABC, abstractmethod
from typing import List
-
+from onapsdk.configuration import settings
class BaseStep(ABC):
"""Base step class."""
+ _logger: logging.Logger = logging.getLogger("")
+
+ def __init_subclass__(cls):
+ """Subclass initialization.
+
+ Add _logger property for any BaseStep subclass
+ """
+ super().__init_subclass__()
+ cls._logger: logging.Logger = logging.getLogger("")
+ logging.config.dictConfig(settings.LOG_CONFIG)
+
def __init__(self, cleanup: bool = False) -> None:
"""Step initialization.
@@ -16,6 +30,8 @@ class BaseStep(ABC):
self._cleanup: bool = cleanup
self._parent: "BaseStep" = None
+
+
def add_step(self, step: "BaseStep") -> None:
"""Add substep.