]> git.ipfire.org Git - nitsi.git/blobdiff - test.py
We now use the logging module
[nitsi.git] / test.py
diff --git a/test.py b/test.py
index c2d62ce9412efd9c99e8b60f8bd337fed0c9853a..9ea57981e5b4a47acad742d593c40fe1e965e44f 100755 (executable)
--- a/test.py
+++ b/test.py
@@ -7,26 +7,20 @@ import os
 
 import configparser
 
-from disk import disk
+from virtual_environ import virtual_environ
+from recipe import recipe
 
-class log():
-    def __init__(self, log_level):
-        self.log_level = log_level
+import logging
 
-    def debug(self, string):
-        if self.log_level >= 4:
-            print("DEBUG: {}".format(string))
-
-    def error(self, string):
-        print("ERROR: {}".format(string))
+logger = logging.getLogger("nitsi.test")
 
 class test():
     def __init__(self, path):
-        self.log = log(4)
         try:
             self.path = os.path.abspath(path)
+            self.log = logger.getChild(os.path.basename(self.path))
         except BaseException as e:
-            self.log.error("Could not get absolute path")
+            logger.error("Could not get absolute path")
 
         self.log.debug(self.path)
 
@@ -79,6 +73,7 @@ class test():
 
         self.log.debug("Try to login on all machines")
         for name in self.virtual_environ.machine_names:
+            self.log.debug("Try to login on {}".format(name))
             self.virtual_machines[name].login()
 
     def load_recipe(self):