-
Notifications
You must be signed in to change notification settings - Fork 38
/
__init__.py
33 lines (26 loc) · 973 Bytes
/
__init__.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
"""
The ``beacon`` package contains code to start a Beacon Rest API.
"""
__title__ = 'Beacon v2.0'
__version__ = VERSION = '2.0'
__author__ = 'CRG developers'
__license__ = 'Apache 2.0'
__copyright__ = 'Beacon 2.0 @ CRG, Barcelona'
import sys
if sys.version_info < (3, 7):
print("beacon-python requires python 3.7 or higher", file=sys.stderr)
sys.exit(1)
# Send warnings using the package warnings to the logging system
# The warnings are logged to a logger named 'py.warnings' with a severity of WARNING.
# See: https://docs.python.org/3/library/logging.html#integration-with-the-warnings-module
import logging
import warnings
from logging.config import dictConfig
from pathlib import Path
import yaml
logging.captureWarnings(True)
warnings.simplefilter("default") # do not ignore Deprecation Warnings
def load_logger():
log_file = Path(__file__).parent / "logger.yml"
with open(log_file, 'r') as stream:
dictConfig(yaml.safe_load(stream))