Skip to content

Commit 8ed86fd

Browse files
authored
Fix ColourFormatter breaking formatting for critical logs (#525)
* Fix CRITICAL level colour escape code * Document coloured formatting fix in the changelog
1 parent abede77 commit 8ed86fd

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

docs/getting-started/changelog.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Changelog
1313
- Added - :func:`~twitchio.PartialUser.fetch_hype_train_status`
1414
- Added - :func:`~twitchio.PartialUser.fetch_stream`
1515

16+
- Bug fixes
17+
- Fix :func:`~twitchio.utils.setup_logging` breaking coloured formatting on `CRITICAL` logging level
18+
1619

1720
3.1.0
1821
=====
@@ -111,7 +114,7 @@ Changelog
111114
- Added :meth:`twitchio.ShoutoutReceive.respond`
112115
- Added :meth:`twitchio.StreamOnline.respond`
113116
- Added :meth:`twitchio.StreamOffline.respond`
114-
117+
115118
- Bug fixes
116119
- Remove the unnecessary ``token_for`` parameter from :meth:`twitchio.ChannelPointsReward.fetch_reward`. `#510 <https://github.com/PythonistaGuild/TwitchIO/pull/510>`_
117120

@@ -152,10 +155,10 @@ Changelog
152155
- Added :meth:`twitchio.ext.commands.Command.run_guards`
153156
- Added :meth:`twitchio.ext.commands.Context.fetch_command`
154157
- :class:`~twitchio.ext.commands.Context` is now ``Generic`` and accepts a generic argument bound to :class:`~twitchio.ext.commands.Bot` or :class:`~twitchio.ext.commands.AutoBot`.
155-
158+
156159
- Bug fixes
157160
- Prevent multiple :class:`~twitchio.ext.commands.Component`'s of the same name being added to a bot resulting in one overriding the other.
158-
161+
159162

160163
3.0.0
161164
======
@@ -171,31 +174,31 @@ The changelog for this version is too large to display. Please see :ref:`Migrati
171174
- ext.commands
172175
- Changes
173176
- Added which alias failed to load in the error raised by :func:`~twitchio.ext.commands.Bot.add_command`
174-
177+
175178
- Bug fixes
176179
- fix string parser not properly parsing specific quoted strings
177180

178181
- ext.eventsub
179182
- Additions
180183
- Added :meth:`EventSubClient.subscribe_channel_unban_request_create <twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_create>` /
181184
:meth:`EventSubWSClient.subscribe_channel_unban_request_create <twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_create>`
182-
- Added :meth:`EventSubClient.subscribe_channel_unban_request_resolve <twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_resolve>` /
185+
- Added :meth:`EventSubClient.subscribe_channel_unban_request_resolve <twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_resolve>` /
183186
:meth:`EventSubWSClient.subscribe_channel_unban_request_resolve <twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_resolve>`
184-
- Added :meth:`EventSubClient.subscribe_automod_terms_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_terms_update>` /
187+
- Added :meth:`EventSubClient.subscribe_automod_terms_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_terms_update>` /
185188
:meth:`EventSubWSClient.subscribe_automod_terms_update <twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_terms_update>`
186-
- Added :meth:`EventSubClient.subscribe_automod_settings_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_settings_update>` /
189+
- Added :meth:`EventSubClient.subscribe_automod_settings_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_settings_update>` /
187190
:meth:`EventSubWSClient.subscribe_automod_settings_update <twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_settings_update>`
188-
- Added :meth:`EventSubClient.subscribe_automod_message_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_update>` /
191+
- Added :meth:`EventSubClient.subscribe_automod_message_update <twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_update>` /
189192
:meth:`EventSubWSClient.subscribe_automod_message_update <twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_update>`
190-
- Added :meth:`EventSubClient.subscribe_automod_message_hold <twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_hold>` /
193+
- Added :meth:`EventSubClient.subscribe_automod_message_hold <twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_hold>` /
191194
:meth:`EventSubWSClient.subscribe_automod_message_hold <twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_hold>`
192-
- Added :meth:`EventSubClient.subscribe_channel_moderate <twitchio.ext.eventsub.EventSubClient.subscribe_channel_moderate>` /
195+
- Added :meth:`EventSubClient.subscribe_channel_moderate <twitchio.ext.eventsub.EventSubClient.subscribe_channel_moderate>` /
193196
:meth:`EventSubWSClient.subscribe_channel_moderate <twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_moderate>`
194-
- Added :meth:`EventSubClient.subscribe_suspicious_user_update <twitchio.ext.eventsub.EventSubClient.subscribe_suspicious_user_update>` /
197+
- Added :meth:`EventSubClient.subscribe_suspicious_user_update <twitchio.ext.eventsub.EventSubClient.subscribe_suspicious_user_update>` /
195198
:meth:`EventSubWSClient.subscribe_suspicious_user_update <twitchio.ext.eventsub.EventSubWSClient.subscribe_suspicious_user_update>`
196-
- Added :meth:`EventSubClient.subscribe_channel_vip_add <twitchio.ext.eventsub.EventSubClient.subscribe_channel_vip_add>` /
199+
- Added :meth:`EventSubClient.subscribe_channel_vip_add <twitchio.ext.eventsub.EventSubClient.subscribe_channel_vip_add>` /
197200
:meth:`EventSubWSClient.subscribe_channel_vip_add <twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_vip_add>`
198-
- Added :meth:`EventSubClient.subscribe_channel_vip_remove <twitchio.ext.eventsub.EventSubClient.subscribe_channel_vip_remove>` /
201+
- Added :meth:`EventSubClient.subscribe_channel_vip_remove <twitchio.ext.eventsub.EventSubClient.subscribe_channel_vip_remove>` /
199202
:meth:`EventSubWSClient.subscribe_channel_vip_remove <twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_vip_remove>`
200203
- Added all accompanying models for those endpoints.
201204
- ext.sounds
@@ -680,4 +683,4 @@ New logo!
680683

681684
- ext.eventsub
682685
- fix :class:`ext.eventsub.models.ChannelBanData`'s ``permanent`` attribute accessing nonexistent attrs from the event payload
683-
- Add documentation
686+
- Add documentation

twitchio/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
164164
logging.INFO: "\x1b[38;2;100;55;215;1m",
165165
logging.WARNING: "\x1b[38;2;204;189;51;1m",
166166
logging.ERROR: "\x1b[38;2;161;38;46m",
167-
logging.CRITICAL: "\x1b[48;2;161;38;46",
167+
logging.CRITICAL: "\x1b[48;2;161;38;46m",
168168
}
169169

170170
elif self._supports_colour:
@@ -173,7 +173,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
173173
logging.INFO: "\x1b[34;1m",
174174
logging.WARNING: "\x1b[33;1m",
175175
logging.ERROR: "\x1b[31m",
176-
logging.CRITICAL: "\x1b[41",
176+
logging.CRITICAL: "\x1b[41m",
177177
}
178178

179179
self._FORMATS: dict[int, logging.Formatter] = {

0 commit comments

Comments
 (0)