aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/mass-pnf-sim.py
blob: ce8cd73a60fc32fd72771875dd93372d275ae59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
import sys
import logging
from MassPnfSim import MassPnfSim, get_parser

if __name__ == '__main__':
    parser = get_parser()
    args = parser.parse_args()
    log_lvl = getattr(logging, args.verbose.upper())

    if sys.stdout.isatty():
        logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
    else:
        logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')

    logger = logging.getLogger(__name__)
    logger.setLevel(log_lvl)
    MassPnfSim.log_lvl = log_lvl

    if args.subcommand is not None:
        sim_routine = getattr(MassPnfSim(), args.subcommand)
        sim_routine(args)
    else:
        parser.print_usage()