diff --git a/bots.py b/bots.py index 4d84375c..0a99042e 100644 --- a/bots.py +++ b/bots.py @@ -5,9 +5,11 @@ import redditbot import statsupdater import time import logging +import coloredlogs logging.getLogger().setLevel(level=logging.ERROR) logging.getLogger(__name__).setLevel(level=logging.DEBUG) +coloredlogs.install(level="DEBUG") discord_telegram_pipe = multiprocessing.Pipe() discord = multiprocessing.Process(target=discordbot.process, args=(discord_telegram_pipe[0],), daemon=True) diff --git a/discordbot.py b/discordbot.py index 804849a6..a6d804ca 100644 --- a/discordbot.py +++ b/discordbot.py @@ -18,10 +18,11 @@ import logging import errors import datetime import sqlalchemy.exc +import coloredlogs logging.getLogger().setLevel(level=logging.ERROR) logger = logging.getLogger(__name__) -logger.setLevel(level=logging.DEBUG) +coloredlogs.install(level="DEBUG", logger=logger) # Queue emojis queue_emojis = [":one:", @@ -349,7 +350,7 @@ class RoyalDiscordBot(discord.Client): await self.wait_until_ready() while True: msg = await loop.run_in_executor(executor, connection.recv) - logger.info(f"Received \"{msg}\" from the Telegram-Discord pipe.") + logger.debug(f"Received \"{msg}\" from the Telegram-Discord pipe.") if msg == "get cv": discord_members = list(self.main_guild.members) channels = {0: None} diff --git a/redditbot.py b/redditbot.py index 830c3797..98fe43cf 100644 --- a/redditbot.py +++ b/redditbot.py @@ -7,6 +7,7 @@ import time import raven import os import sys +import coloredlogs # Init the config reader config = configparser.ConfigParser() @@ -14,7 +15,7 @@ config.read("config.ini") logging.getLogger().setLevel(level=logging.ERROR) logger = logging.getLogger(__name__) -logger.setLevel(level=logging.DEBUG) +coloredlogs.install(level="DEBUG", logger=logger) sentry = raven.Client(config["Sentry"]["token"], release=raven.fetch_git_sha(os.path.dirname(__file__)), diff --git a/requirements.txt b/requirements.txt index bed0da61..7f22d54a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,5 @@ pygments markovify praw dice -raven[flask] \ No newline at end of file +raven[flask] +coloredlogs \ No newline at end of file diff --git a/statsupdater.py b/statsupdater.py index 20791b2f..8bc4044e 100644 --- a/statsupdater.py +++ b/statsupdater.py @@ -7,10 +7,11 @@ import os import typing import telegram import sys +import coloredlogs logging.getLogger().setLevel(level=logging.ERROR) logger = logging.getLogger(__name__) -logger.setLevel(level=logging.DEBUG) +coloredlogs.install(level="DEBUG", logger=logger) # Init the config reader config = configparser.ConfigParser() diff --git a/telegrambot.py b/telegrambot.py index e3c8332c..8625db74 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -6,17 +6,16 @@ import errors import stagismo from telegram import Bot, Update, InlineKeyboardMarkup, InlineKeyboardButton from telegram.ext import Updater, CommandHandler, CallbackQueryHandler -import telegram.error import dice import sys import os -import time import cast import re import logging import configparser import markovify import raven +import coloredlogs # Markov model try: @@ -27,7 +26,7 @@ except Exception: logging.getLogger().setLevel(level=logging.ERROR) logger = logging.getLogger(__name__) -logger.setLevel(level=logging.DEBUG) +coloredlogs.install(level="DEBUG", logger=logger) # Init the config reader config = configparser.ConfigParser()