You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
info log lines from discord.py are being directed to sys.stderr
Reproduction Steps
just ran the bot
Minimal Reproducible Code
classWalleBot(commands.Bot):
def__init__(self):
super().__init__(command_prefix='.', intents=intents)
self.bot_loop_manager=BotChannelManager(wall_e_config, self)
asyncdefsetup_hook(self) ->None:
# removing default help command to allow for custom help commandprint("[main.py] default help command being removed")
self.remove_command("help")
awaitself.add_custom_cog()
awaitsuper().setup_hook()
asyncdefadd_custom_cog(self, module_path_and_name: str=None):
pass# not relevant to issuebot=WalleBot()
bot.run(TOKEN)
Expected Results
I expected the below 2 log lines to be white like all the other lines which would indicate they are being sent to sys.stdout
Actual Results
the red highlighting that PyCharm places on the lines indicates they are actually being printed to sys.stderr
Intents
Intents.all()
System Information
$ python -m discord -v
Python v3.9.2-final
discord.py v2.3.2-final
aiohttp v3.8.5
system info: Linux 5.10.0-25-amd64 1 SMP Debian 5.10.191-1 (2023-08-16)
Checklist
I have searched the open issues for duplicates.
I have shown the entire traceback, if possible.
I have removed my token from display, if visible.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
I updated the run command to bot.run(TOKEN, log_handler=logging.StreamHandler(sys.stdout)) as suggested so that the INFO log levels get directed to stdout instead but this also resulted in ERROR log lines also going to stdout instead of stderr.
Can I ask for a pointer on how to get this library to redirect only INFO log lines to sys.stdout?
This isn't really discord.py related. This library just uses the standard logging library to do the calls and the handlers are provided by the standard library. If you want mixed streams in your handler you'd have to make your own that switches the stream depending on the logging level of the record object. This code's untested but it should probably work:
Summary
info log lines from discord.py are being directed to sys.stderr
Reproduction Steps
just ran the bot
Minimal Reproducible Code
Expected Results
I expected the below 2 log lines to be white like all the other lines which would indicate they are being sent to
sys.stdout
Actual Results
the red highlighting that PyCharm places on the lines indicates they are actually being printed to
sys.stderr
Intents
Intents.all()
System Information
$ python -m discord -v
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: