#!/usr/bin/env python3

import sys
import os

if sys.version_info[:3] < (3, 6, 5) or sys.version_info[:2] >= (3, 7):
    sys.stderr.write('Required python is >= 3.6.5 and < 3.7.0 \n')
    sys.stderr.write('Your python version is: %d.%d.%d\n' % sys.version_info[:3])
    sys.exit(1)

# #TODO: make wrapper script that set PYTHONPATH instead
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'analytics'))

import logging

root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)


logging_formatter = logging.Formatter("%(asctime)s [Analytics] [%(levelname)-5.5s]  %(message)s")

logging_handler = logging.StreamHandler(sys.stdout)
logging_handler.setLevel(logging.DEBUG)
logging_handler.setFormatter(logging_formatter)

root_logger.addHandler(logging_handler)


from server import run_server

if __name__ == "__main__":
    run_server()