From: Jonatan Schlag Date: Tue, 1 May 2018 08:23:20 +0000 (+0200) Subject: Log all messages to a recipe with the name of the corresponding test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=518441dedfa29fe9691d063dba876453d8d86e67;p=nitsi.git Log all messages to a recipe with the name of the corresponding test Signed-off-by: Jonatan Schlag --- 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