Closed AtieP closed 4 years ago
I'm using crayons as I want the print text to be colored, it isn't meant for logging at all.
You can use coloredlogs for colored logging. Note that you need to install colorama
if you are using Windows.
import logging
import sys
import coloredlogs
format = "%(asctime)s | %(name)s | %(levelname)s | %(message)s"
root_logger = logging.getLogger()
coloredlogs.DEFAULT_LOG_FORMAT = format
coloredlogs.DEFAULT_LOG_LEVEL = logging.DEBUG
coloredlogs.install(logger=root_logger, stream=sys.stdout)
# Set log level to WARNING to all internal loggers
logging.getLogger("aiosasl").setLevel(logging.WARNING)
logging.getLogger("aioxmpp").setLevel(logging.WARNING)
logging.getLogger("asyncio").setLevel(logging.WARNING)
logging.getLogger("fortnitepy").setLevel(logging.WARNING)
# Use this logger for logging.
logger = logging.getLogger(__name__)```
Happy now?
Wow, this is better. Now the bot is modular and it's easier to read.
Please, rewrite this. This is both a mess and inconsistent. You use colored prints instead of
coloredlogs
. You put everything on a single file and the result is a messy 2000 liner file. Create a new folder. Make a new file with the bot class. Then another__main__.py
file that runs the bot as a module. Make a new folder with extensions there. Then load them from the__main__.py
. It's for your and our sanity.