38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
""""
|
|
Geoffrey Minecraft Info Database
|
|
|
|
Created by: Joey Hines (ZeroHD)
|
|
|
|
"""
|
|
import logging
|
|
import logging.handlers as handlers
|
|
import bot
|
|
from BotConfig import bot_config
|
|
|
|
|
|
def setup_logging():
|
|
|
|
discord_logger = logging.getLogger('discord')
|
|
discord_logger.setLevel(logging.INFO)
|
|
sql_logger = logging.getLogger('sqlalchemy.engine')
|
|
sql_logger.setLevel(logging.INFO)
|
|
bot_logger = logging.getLogger('bot')
|
|
bot_logger.setLevel(logging.INFO)
|
|
|
|
handler = handlers.TimedRotatingFileHandler(filename='Geoffrey.log', when='D',
|
|
interval=bot_config.rotation_duration, backupCount=bot_config.count,
|
|
encoding='utf-8')
|
|
|
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
|
|
|
discord_logger.addHandler(handler)
|
|
sql_logger.addHandler(handler)
|
|
bot_logger.addHandler(handler)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
print("Starting logging...")
|
|
setup_logging()
|
|
print("Starting bot...")
|
|
bot.start_bot()
|