-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.py
More file actions
38 lines (30 loc) · 1002 Bytes
/
Copy pathbootstrap.py
File metadata and controls
38 lines (30 loc) · 1002 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
35
36
37
38
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
from app.application import Application
DEBUG = os.environ.get('DEBUG', False)
def entrypoint():
if DEBUG:
logging.basicConfig(
format='{"timestamp": "%(asctime)s", "level": "%(levelname)s", "message": "%(message)s"}',
level=logging.DEBUG,
datefmt='%d-%b-%y %H:%M:%S'
)
else:
logging.basicConfig(
format='{"timestamp": "%(asctime)s", "level": "%(levelname)s", "message": "%(message)s"}',
level=logging.INFO,
datefmt='%d-%b-%y %H:%M:%S'
)
path = os.path.dirname(os.path.realpath(__file__))
app = Application(path, logging)
try:
logging.info('Application starting')
app.main()
except KeyboardInterrupt:
logging.info('Application interrupted by user request [CRTL+C]')
finally:
logging.info('Application stopped')
if __name__ == '__main__':
entrypoint()