From 518441dedfa29fe9691d063dba876453d8d86e67 Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Tue, 1 May 2018 10:23:20 +0200 Subject: [PATCH] Log all messages to a recipe with the name of the corresponding test Signed-off-by: Jonatan Schlag --- recipe.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipe.py b/recipe.py index 3a9b009..725e099 100644 --- 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 -- 2.39.2