-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable discord.py logger by default. #3216
Conversation
0545ef5
to
b05f464
Compare
da4b2b1
to
fddae20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I made a few changes, notably:
- discord.py logs won't be logged into a separate log file, but instead the same file as the bot.
- Changed
maxBytes
from 48000 (48kb) to 28000000 (28mb), the previous value was only enough for 6000 characters. - Some stylistic changes, and updated changelog.
Would be great if you can double-check my edit, and then this PR's good to go!
Looks good to me. But I just got this error when scrolling through the pages from 2023-07-13 16:16:33 discord.ui.view[412] - ERROR: Ignoring exception in view <PaginatorView timeout=210 children=5> for item <PageButton style=<ButtonStyle.primary: 1> url=None disabled=False label='>' emoji=None row=None>
Traceback (most recent call last):
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ui/view.py", line 425, in _scheduled_task
await item.callback(interaction)
File "/User/Projects/modmail/core/paginator.py", line 285, in callback
await interaction.response.edit_message(**kwargs, view=self.view)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/interactions.py", line 812, in edit_message
await adapter.create_interaction_response(
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/webhook/async_.py", line 221, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.content: Must be 2000 or fewer in length. Maybe some of the lines just have more than 2000 characters in it (single line)? Update: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me!
* Enable `discord.py` logger by default. * Revert: - Restore import orders - Logging stuff is now completely handled in `core.models.configure_logging` * Update logging configurations * Updated changelog * Fix overflow characters in logs when using `?debug` command. * Update changelog --------- Co-authored-by: Taku <45324516+Taaku18@users.noreply.github.com>
* Enable `discord.py` logger by default. * Revert: - Restore import orders - Logging stuff is now completely handled in `core.models.configure_logging` * Update logging configurations * Updated changelog * Fix overflow characters in logs when using `?debug` command. * Update changelog --------- Co-authored-by: Taku <45324516+Taaku18@users.noreply.github.com> (cherry picked from commit 43fbc31) Signed-off-by: Khakers <22665282+khakers@users.noreply.github.com>
* Enable `discord.py` logger by default. * Revert: - Restore import orders - Logging stuff is now completely handled in `core.models.configure_logging` * Update logging configurations * Updated changelog * Fix overflow characters in logs when using `?debug` command. * Update changelog --------- Co-authored-by: Taku <45324516+Taaku18@users.noreply.github.com> (cherry picked from commit 43fbc31) Signed-off-by: Khakers <22665282+khakers@users.noreply.github.com>
Refer to #3213.
sys.stdout
by default.INFO
level.LOG_DISCORD
DISCORD_LOG_LEVEL
env config variable is set toDEBUG
, theDEBUG
level logs will be logged into a file i.e.discord.log
separately while still logging theINFO
level tosys.stdout
.Reorder imports and move logger stuff to top to properly initializecolorama
and set text color to loggers. Otherwise thediscord.py
logger text would be in white. This is kinda un-pythonic (type-checker will not like this). Proper way would be creating a new file for logger classes and stuff, and do early import of that file inbot.py
to initialize those. I saw the implementation in Red-DiscordBot if I remember correctly. Let me know if this should be reverted.