Closed 2Cubed closed 7 years ago
This was finished on the feature/handlers
branch.
Currently empty. Need to add content, which will be possible once #43 is complete.
@2Cubed I thought you said nothing needed to be added as of now?
@Innectic Correct, but we shouldn't close the issue until we've actually added the things.
Something we should add, though, is a built-in logger.
import logging
class Handler(object):
"""Abstract handler."""
def __init__(self):
self.logger = logging.getLogger(__name__)
class PotatoHandler(object):
def on_potato(self, potato):
self.logger.debug("We got a potato! (%s)", potato)
@2Cubed I'll make that a thing real fast.
@2Cubed Done in commit: 32d878aed050bdf502b9980f380370d1e620bbd6
@Innectic Whoa, nice! Only complaint is this:
def on_message(self, packet):
"""Handle message events."""
self.logger.debug(packet)
self.logger.info(
''.join(chunk["text"] for chunk in packet if chunk["type"] == chunk["text"])
)
IMHO, we should keep the LoggingHandler
(#48) and move those logging statements there.
@2Cubed I don't see any use to keeping the logging handler if Handler
contains a logger. Maybe you can prove me wrong?
What else might this need? Currently, it's essentially an empty class.
I'm not sure if anything is needed in there, at the moment.
@Innectic Yeah, me neither. I feel like there should be something, but... :thinking:
@2Cubed I think we could close this.
@Innectic Renamed to Handler system
, because that's a much better description of what this issue is for.
Completed on feature/handlers
branch, merged in #81.
A class for all handlers to inherit from. Uses
on_
methods for event handling.