1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Log formatting

This commit is contained in:
Steffo 2018-09-19 00:13:41 +02:00
parent db237412e2
commit fe6e3ba1a6
6 changed files with 11 additions and 2 deletions

View file

@ -8,10 +8,10 @@ import logging
import coloredlogs import coloredlogs
import os import os
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
logging.getLogger().disabled = True logging.getLogger().disabled = True
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger) coloredlogs.install(level="DEBUG", logger=logger)
discord_telegram_pipe = multiprocessing.Pipe() discord_telegram_pipe = multiprocessing.Pipe()

7
db.py
View file

@ -1,6 +1,7 @@
import datetime import datetime
import logging import logging
import os
import coloredlogs
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship, joinedload from sqlalchemy.orm import sessionmaker, relationship, joinedload
from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.hybrid import hybrid_property
@ -22,6 +23,10 @@ engine = create_engine(config["Database"]["database_uri"])
Base = declarative_base(bind=engine) Base = declarative_base(bind=engine)
Session = sessionmaker(bind=engine) Session = sessionmaker(bind=engine)
logging.getLogger().disabled = True
logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger)
class Royal(Base): class Royal(Base):
__tablename__ = "royals" __tablename__ = "royals"

View file

@ -22,6 +22,7 @@ import coloredlogs
logging.getLogger().disabled = True logging.getLogger().disabled = True
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger) coloredlogs.install(level="DEBUG", logger=logger)
# Queue emojis # Queue emojis

View file

@ -15,6 +15,7 @@ config.read("config.ini")
logging.getLogger().disabled = True logging.getLogger().disabled = True
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger) coloredlogs.install(level="DEBUG", logger=logger)
sentry = raven.Client(config["Sentry"]["token"], sentry = raven.Client(config["Sentry"]["token"],

View file

@ -11,6 +11,7 @@ import coloredlogs
logging.getLogger().disabled = True logging.getLogger().disabled = True
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger) coloredlogs.install(level="DEBUG", logger=logger)
# Init the config reader # Init the config reader

View file

@ -26,6 +26,7 @@ except Exception:
logging.getLogger().disabled = True logging.getLogger().disabled = True
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
os.environ["COLOREDLOGS_LOG_FORMAT"] = "%(asctime)s %(levelname)s %(name)s %(message)s"
coloredlogs.install(level="DEBUG", logger=logger) coloredlogs.install(level="DEBUG", logger=logger)
# Init the config reader # Init the config reader