import logging
from os import getenv

from simple_json_logger import JsonLogger


DATETIME_FORMAT = getenv("SIEVE_SDK_DATETIME_FORMAT", "%Y-%m-%d %H:%M:%S")
VERIFY_SSL = getenv('SIEVE_SDK_VERIFY_SSL', '1') == '1'
LOG_LEVEL = int(getenv('SIEVE_LOG_LEVEL', logging.DEBUG))
MAX_CONCURRENT_REQUESTS = int(getenv('SIEVE_SDK_MAX_CONCURRENT_REQUESTS', 200))
MAX_CONCURRENT_REQUESTS_PER_HOST = int(getenv('SIEVE_SDK_MAX_CONCURRENT_REQUESTS_PER_HOST', 0))
PROXY_ADDRESS = getenv('SIEVE_PROXY_ADDRESS', 'socks5://127.0.0.1:8080')
PROXY_SHOULD_REMOTE_RESOLVE = getenv('SIEVE_SDK_PROXY_SHOULD_REMOTE_RESOLVE', '1') == '1'

logger = JsonLogger(level=LOG_LEVEL)
