Commit c990b09b authored by eric pellegrini's avatar eric pellegrini

implemented a write method so as ConsoleHandler behaves as a file-like object

parent 1b436c73
......@@ -82,6 +82,10 @@ class ConsoleHandler(IHandler, logging.Handler):
@type record: logging.LogRecord
"""
record.msg = record.msg.strip()
if not record.msg:
return
self.style.SetTextColour(ConsoleHandler.COLORS.get(record.levelname,wx.BLACK))
# Set the the created text attribute as the default style for the text ctrl.
......@@ -91,5 +95,11 @@ class ConsoleHandler(IHandler, logging.Handler):
self._window.AppendText(self.format(record))
self._window.AppendText("\n")
def write(self,message):
record = logging.LogRecord("console",logging.INFO,None,None,message,None,None,None)
self.emit(record)
REGISTRY["console"] = ConsoleHandler
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment