2018-08-11 21:07:33 +00:00
|
|
|
""""
|
|
|
|
Geoffrey Minecraft Info Database
|
2018-07-21 18:28:31 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
Created by: Joey Hines (ZeroHD)
|
2018-05-22 02:41:15 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
"""
|
|
|
|
import logging
|
|
|
|
import logging.handlers as handlers
|
2018-08-12 19:00:04 +00:00
|
|
|
from sys import stdout
|
|
|
|
|
2018-08-21 20:36:51 +00:00
|
|
|
from geoffrey import bot
|
|
|
|
from geoffrey.BotConfig import bot_config
|
2018-07-14 22:25:33 +00:00
|
|
|
|
2018-08-05 22:20:37 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
def setup_logging():
|
2018-05-25 16:32:29 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
discord_logger = logging.getLogger('discord')
|
2018-08-19 14:57:19 +00:00
|
|
|
discord_logger.setLevel(logging.INFO)
|
2018-08-11 21:07:33 +00:00
|
|
|
sql_logger = logging.getLogger('sqlalchemy.engine')
|
2018-08-19 14:57:19 +00:00
|
|
|
sql_logger.setLevel(logging.INFO)
|
2018-08-25 17:30:53 +00:00
|
|
|
bot_info_logger = logging.getLogger('geoffrey.bot')
|
2018-08-12 15:32:35 +00:00
|
|
|
bot_info_logger.setLevel(logging.INFO)
|
2018-05-25 22:00:43 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
handler = handlers.TimedRotatingFileHandler(filename='Geoffrey.log', when='D',
|
|
|
|
interval=bot_config.rotation_duration, backupCount=bot_config.count,
|
|
|
|
encoding='utf-8')
|
2018-05-25 16:32:29 +00:00
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
2018-06-23 16:08:40 +00:00
|
|
|
|
2018-08-12 15:32:35 +00:00
|
|
|
console = logging.StreamHandler(stdout)
|
|
|
|
|
|
|
|
console.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
|
|
|
|
2018-08-11 21:07:33 +00:00
|
|
|
discord_logger.addHandler(handler)
|
|
|
|
sql_logger.addHandler(handler)
|
2018-08-12 15:32:35 +00:00
|
|
|
bot_info_logger.addHandler(handler)
|
|
|
|
bot_info_logger.addHandler(console)
|
2018-06-03 02:42:31 +00:00
|
|
|
|
2018-05-21 16:57:20 +00:00
|
|
|
|
2018-08-05 22:20:37 +00:00
|
|
|
if __name__ == '__main__':
|
2018-08-11 23:02:50 +00:00
|
|
|
print("Starting logging...")
|
2018-08-11 21:07:33 +00:00
|
|
|
setup_logging()
|
2018-08-11 23:02:50 +00:00
|
|
|
print("Starting bot...")
|
2018-08-12 03:21:21 +00:00
|
|
|
bot.start_bot()
|