bot: main: fix root logger not being initialised correctly
tl;dr: shouldn't have passed __name__ to logging.getLogger() This also makes it so that discord.py is logging everything as expected, which it didn't do before. Signed-off-by: Max R. Carrara <max@aequito.sh>
This commit is contained in:
parent
1dfa03bc17
commit
18f057793e
1 changed files with 4 additions and 6 deletions
|
|
@ -11,11 +11,11 @@ from discord.ext import commands
|
||||||
from bot.env import Environment
|
from bot.env import Environment
|
||||||
|
|
||||||
|
|
||||||
_log: logging.Logger
|
_log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_logging() -> logging.Logger:
|
def setup_logging():
|
||||||
root_logger = logging.getLogger(__name__)
|
root_logger = logging.getLogger()
|
||||||
|
|
||||||
log_level_map = {
|
log_level_map = {
|
||||||
"NOTSET": logging.NOTSET,
|
"NOTSET": logging.NOTSET,
|
||||||
|
|
@ -57,8 +57,6 @@ def setup_logging() -> logging.Logger:
|
||||||
log_error_file_handler.setLevel(logging.ERROR)
|
log_error_file_handler.setLevel(logging.ERROR)
|
||||||
root_logger.addHandler(log_error_file_handler)
|
root_logger.addHandler(log_error_file_handler)
|
||||||
|
|
||||||
return root_logger
|
|
||||||
|
|
||||||
|
|
||||||
def setup_bot() -> commands.Bot:
|
def setup_bot() -> commands.Bot:
|
||||||
intents = discord.Intents.all()
|
intents = discord.Intents.all()
|
||||||
|
|
@ -181,7 +179,7 @@ async def main():
|
||||||
await bot.start(token=token, reconnect=True)
|
await bot.start(token=token, reconnect=True)
|
||||||
|
|
||||||
|
|
||||||
_log = setup_logging()
|
setup_logging()
|
||||||
_log.debug("Logging initialised")
|
_log.debug("Logging initialised")
|
||||||
|
|
||||||
_log.debug(f"{sys.argv = }")
|
_log.debug(f"{sys.argv = }")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue