gramps/gramps2/src/GrampsLogger/_GtkHandler.py
Richard Taylor 41e81a1034 dont show exception twice.
svn: r5696
2006-01-08 20:31:39 +00:00

35 lines
722 B
Python

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.
"""
self._record = record
ErrorView(error_detail=self,rotate_handler=self._rotate_handler)
def get_formatted_log(self):
return self.format(self._record)
def get_record(self):
return self._record