-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
34 lines (26 loc) · 1013 Bytes
/
utils.py
File metadata and controls
34 lines (26 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
import json
import logging, os
def get_logger(name):
format = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
console_handler = logging.StreamHandler()
console_handler.setFormatter(format)
logger.addHandler(console_handler)
#if not os.path.exists("logs"): os.makedirs("logs")
file_handler = logging.FileHandler("deploy.log")
file_handler.setFormatter(format)
logger.addHandler(file_handler)
return logger
def get_option():
parser = argparse.ArgumentParser(description='Description of your program')
parser.add_argument('-p', '--localPackage', help='path for the jaz file')
parser.add_argument('-ip', '--ipAddress', help='ip addresses')
args = vars(parser.parse_args())
return args
def get_config():
configs = json.load(open('config.json'))
opt_dict=get_option()
configs = {**configs, **opt_dict} ## merge two dict
return configs