-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
45 lines (35 loc) · 837 Bytes
/
main.py
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
35
36
37
38
39
40
41
42
43
44
45
import logging
import signal
import sys
import click
import hugo as hugomodule
import blog as blogmodule
@click.group()
def cli():
pass
@cli.command()
def hugo():
"""
Index hugo site content
"""
hugomodule.run()
@cli.command()
def blog():
"""
Index Hubspot blog content
"""
blogmodule.run()
def sigterm_handler(_signo, _stack_frame):
logging.info("Terminating due to SIGTERM")
sys.exit(0)
if __name__ == '__main__':
# logging setup
root = logging.getLogger()
root.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
root.addHandler(ch)
signal.signal(signal.SIGTERM, sigterm_handler)
cli()