parent
896ee59963
commit
6a18cef002
@ -7,6 +7,7 @@ from sys import version_info, platform
|
||||
from yaml import load, FullLoader
|
||||
from shutil import copyfile
|
||||
from redis import StrictRedis
|
||||
from logging import getLogger, INFO, DEBUG, StreamHandler, basicConfig
|
||||
from distutils2.util import strtobool
|
||||
from coloredlogs import ColoredFormatter
|
||||
from telethon import TelegramClient
|
||||
@ -17,6 +18,14 @@ working_dir = getcwd()
|
||||
config = None
|
||||
help_messages = {}
|
||||
posthog.api_key = '1WepU-o7JwNKYqPNymWr_mrCu3RVPD-p28PUikPDfsI'
|
||||
logs = getLogger(__name__)
|
||||
logging_format = "%(levelname)s [%(asctime)s] [%(name)s] %(message)s"
|
||||
logging_handler = StreamHandler()
|
||||
logging_handler.setFormatter(ColoredFormatter(logging_format))
|
||||
logs.addHandler(logging_handler)
|
||||
basicConfig(level=INFO)
|
||||
getLogger('telethon').setLevel(INFO)
|
||||
logs.setLevel(INFO)
|
||||
|
||||
try:
|
||||
config = load(open(r"config.yml"), Loader=FullLoader)
|
||||
@ -26,6 +35,12 @@ except FileNotFoundError:
|
||||
exit(1)
|
||||
|
||||
|
||||
if strtobool(config['debug']):
|
||||
logs.setLevel(DEBUG)
|
||||
else:
|
||||
logs.setLevel(INFO)
|
||||
|
||||
|
||||
if platform == "linux" or platform == "linux2" or platform == "darwin" or platform == "freebsd7" \
|
||||
or platform == "freebsd8" or platform == "freebsdN" or platform == "openbsd6":
|
||||
logs.info(
|
||||
|
Loading…
Reference in New Issue
Block a user