2006-01-05 16:02:27 +00:00
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from _ErrorView import ErrorView
|
|
|
|
|
|
|
|
|
|
|
|
class GtkHandler(logging.Handler):
|
|
|
|
"""
|
|
|
|
A handler class which pops up a Gtk Window when a log message occurs.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,rotate_handler=None):
|
|
|
|
"""
|
|
|
|
Initialize the handler with a optional rotate_logger instance.
|
|
|
|
"""
|
|
|
|
logging.Handler.__init__(self)
|
|
|
|
self._rotate_handler = rotate_handler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def emit(self, record):
|
|
|
|
"""
|
|
|
|
Add the record to the rotating buffer.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2008-01-05 20:10:26 +00:00
|
|
|
self._record = record
|
2006-01-08 20:31:39 +00:00
|
|
|
ErrorView(error_detail=self,rotate_handler=self._rotate_handler)
|
|
|
|
|
|
|
|
def get_formatted_log(self):
|
2008-01-05 20:10:26 +00:00
|
|
|
return self.format(self._record)
|
2006-01-08 20:31:39 +00:00
|
|
|
|
|
|
|
def get_record(self):
|
2008-01-05 20:10:26 +00:00
|
|
|
return self._record
|