]>
git.ipfire.org Git - nitsi.git/blob - nitsi.in
3 from nitsi
.test
import test
4 from nitsi
.logger
import init_logging
7 from nitsi
.recipe
import RecipeExeption
9 from nitsi
.test
import TestException
11 logger
= logging
.getLogger("nitsi")
12 logger
.setLevel(logging
.DEBUG
)
13 # create console handler with a higher log level
14 ch
= logging
.StreamHandler()
15 ch
.setLevel(logging
.DEBUG
)
17 formatter
= logging
.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
18 ch
.setFormatter(formatter
)
19 # add the handlers to the logger
22 if __name__
== "__main__":
25 parser
= argparse
.ArgumentParser()
27 parser
.add_argument("-d", "--directory", dest
="dir")
29 parser
.add_argument("-v" "--version", help="Display version and exit",
30 action
="store_true", dest
="version")
32 args
= parser
.parse_args()
35 logger
.info("nitsi version: {}".format("@PACKAGE_VERSION@"))
37 log_dir
= init_logging(args
.dir)
38 # We now going to log everything to log_dir/genaral.log
39 fh
= logging
.FileHandler("{}/general.log".format(log_dir
))
40 fh
.setLevel(logging
.DEBUG
)
42 logger
.debug("We now logging everything to {}/general.log".format(log_dir
))
44 currenttest
= test(args
.dir, log_dir
)
45 currenttest
.read_settings()
46 currenttest
.virtual_environ_setup()
47 currenttest
.load_recipe()
48 except RecipeExeption
as e
:
53 currenttest
.virtual_environ_start()
54 currenttest
.run_recipe()
55 except TestException
as e
:
58 except BaseException
as e
:
62 currenttest
.virtual_environ_stop()