]> git.ipfire.org Git - people/ms/nitsi.git/commitdiff
Log all messages to a recipe with the name of the corresponding test
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 1 May 2018 08:23:20 +0000 (10:23 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 1 May 2018 08:23:20 +0000 (10:23 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
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