gramps/gramps2/src/GrampsLogger/_GtkHandler.py

35 lines
722 B
Python
Raw Normal View History

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.
"""
2006-01-09 02:01:39 +05:30
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