Teekeks / pyTwitchAPI

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
https://pytwitchapi.dev
MIT License
256 stars 38 forks source link

Subloggers not set properly #314

Closed Julian-O closed 5 months ago

Julian-O commented 5 months ago

In each of twitchAPI/eventsub/websocket.py and twitchAPI/eventsub/webhook.py there is a line of the form:

 self.logger.name = 'twitchAPI.eventsub.<blah>'

This is not the correct way to select to use a sublogger. The logging documents explicitly state that the name attribute should be considered to be read-only.

The consequence is that it is impossible to filter messages from this sublogger (which is how I noticed it).

The correct way is of the form:

self.logger = logging.getLogger("twitchAPI.eventsub.<blah>")
Teekeks commented 5 months ago

Thanks for the report!