]> git.ipfire.org Git - nitsi.git/blobdiff - recipe.py
Log all messages to a recipe with the name of the corresponding test
[nitsi.git] / recipe.py
index 3a9b009deba6e8990cb8b384dd22f579c4d19292..725e099fdbdf95d5ef3e16549d8dc16467cd029d 100644 (file)
--- a/recipe.py
+++ b/recipe.py
@@ -18,8 +18,14 @@ class RecipeExeption(Exception):
 class recipe():
     def __init__(self, path, circle=[]):
         self.recipe_file = path
-        self.log = logger.getChild(os.path.basename(self.recipe_file))
-        self.path = os.path.dirname(self.recipe_file)
+        try:
+            self.path = os.path.dirname(self.recipe_file)
+            self.name = os.path.basename(self.path)
+        except BaseException as e:
+            logger.error("Failed to get the name of the test to this recipe")
+            raise e
+
+        self.log = logger.getChild(self.name)
         self.log.debug("Path of recipe is: {}".format(self.recipe_file))
         self._recipe = None
         self._machines = None