diff --git a/testing/README.md b/testing/README.md index 184656dd..e09dec51 100644 --- a/testing/README.md +++ b/testing/README.md @@ -7,7 +7,7 @@ $ python convert.py -h usage: convert.py [-h] [--des_in file] [--gro_in file file] [--lmp_in file] [--desmond] [--gromacs] [--lammps] [--odir directory] [--oname prefix] [-e] [--efile EFILE] [-d path] [-g path] - [-l path] [-v] [-f] + [-l path] [-v] Perform a file conversion @@ -41,8 +41,7 @@ Other optional arguments: path for GROMACS binary, needed for energy evaluation -l path, --lmppath path path for LAMMPS binary, needed for energy evaluation - -v, --verbose verbosity - -f, --force ignore warnings + -v, --verbose high verbosity, includes DEBUG level output ```` UnitTest.py @@ -51,7 +50,7 @@ UnitTest.py ```` $ python UnitTest.py -h usage: PROG [-h] [--desmond] [--gromacs] [--lammps] [-e] [-d path] [-g path] - [-l path] + [-l path] [-v] InterMol Unit Testing Script -------------------------------- @@ -81,4 +80,6 @@ Other optional arguments: path for GROMACS binary, needed for energy evaluation -l path, --lmppath path path for LAMMPS binary, needed for energy evaluation + -v, --verbose print conversion output to console, -v for INFO level, + -vv for DEBUG level ```` diff --git a/testing/UnitTest.py b/testing/UnitTest.py index dfb3456f..d3ff9ad7 100644 --- a/testing/UnitTest.py +++ b/testing/UnitTest.py @@ -51,6 +51,8 @@ def parse_args(): group_misc.add_argument('-l', '--lmppath', dest='lmppath', metavar='path', default='lmp_openmpi', help='path for LAMMPS binary, needed for energy evaluation') + group_misc.add_argument('-v', '--verbose', dest='verbose', action='count', + help='print conversion output to console, -v for INFO level, -vv for DEBUG level') if len(sys.argv)==1: parser.print_help() sys.exit(1) @@ -217,6 +219,16 @@ def summarize_results(input_type, files, results): def main(): args = parse_args() + if args.verbose: + h = logging.StreamHandler() + if args.verbose == 2: + h.setLevel(logging.DEBUG) # more verbosity + else: # == 1 + h.setLevel(logging.INFO) + f = logging.Formatter("%(levelname)s %(asctime)s %(message)s", "%Y-%m-%d %H:%M:%S") + h.setFormatter(f) + logger.addHandler(h) + if not os.path.isdir(OUTPUT_DIR): os.mkdir(OUTPUT_DIR)