Beispiel #1
0
 def __init__(self,  parent, builder, gui_helper):
     self.parent = parent
     self.run_window = builder.get_object("runWindow")
     self.run_tree_view = builder.get_object("runTreeView")
     self.debug_btn = builder.get_object("debugBtn")
     self.info_box = builder.get_object("infoBox")
     self.scrolled_window = builder.get_object("scrolledWindow")
     self.back_btn = builder.get_object("backBtn")
     self.main_btn = builder.get_object("mainBtn")
     self.tlh = RunLoggingHandler(self, self.run_tree_view)
     self.gui_helper = gui_helper
     logger.addHandler(self.tlh)
     FORMAT = "%(levelname)s %(message)s"
     self.tlh.setFormatter(logging.Formatter(FORMAT))
     logger.setLevel(logging.DEBUG)
     self.store = Gtk.TreeStore(str)
     renderer = Gtk.CellRendererText()
     column = Gtk.TreeViewColumn("Log from current process", renderer, text=0)
     self.run_tree_view.append_column(column)
     self.run_tree_view.set_model(self.store)
     self.stop = threading.Event()
     self.pr = None
     self.link = self.gui_helper.create_button()
     self.info_label = gui_helper.create_label('<span color="#FFA500">In progress...</span>')
     self.info_box.pack_start(self.info_label, False, False, 12)
     self.project_canceled = False
     self.kwargs = {}
     self.current_main_assistant = None
     self.top_assistant = None
     self.close_win = False
     sigint_handler.override()
Beispiel #2
0
 def __init__(self,  parent, builder, gui_helper):
     self.parent = parent
     self.run_window = builder.get_object("runWindow")
     self.run_tree_view = builder.get_object("runTreeView")
     self.cancel_btn = builder.get_object("cancelRunBtn")
     self.debug_btn = builder.get_object("debugBtn")
     self.info_box = builder.get_object("infoBox")
     self.scrolled_window = builder.get_object("scrolledWindow")
     self.back_btn = builder.get_object("backBtn")
     self.tlh = RunLoggingHandler(self, self.run_tree_view)
     self.gui_helper = gui_helper
     logger.addHandler(self.tlh)
     FORMAT = "%(levelname)s %(message)s"
     self.tlh.setFormatter(logging.Formatter(FORMAT))
     logger.setLevel(logging.DEBUG)
     self.store = Gtk.TreeStore(str)
     renderer = Gtk.CellRendererText()
     column = Gtk.TreeViewColumn("Log from current process", renderer, text=0)
     self.run_tree_view.append_column(column)
     self.run_tree_view.set_model(self.store)
     self.stop = threading.Event()
     self.pr = None
     self.link = self.gui_helper.create_button()
     self.info_label = gui_helper.create_label('<span color="#FFA500">In progress...</span>')
     self.project_canceled = False
Beispiel #3
0
    def test_logger_basic(self, capsys):
        console_handler = DevassistantClHandler(sys.stdout)
        console_handler.setFormatter(DevassistantClFormatter())
        console_handler.setLevel(logging.INFO)

        logger.addHandler(console_handler)

        # just test that logging works...
        logger.info('info ...')
        assert capsys.readouterr() == ('INFO: info ...\n', '')
Beispiel #4
0
 def __init__(self,  parent, finalWindow, builder, assistant):
     self.parent = parent
     self.finalWindow = finalWindow
     self.runWindow = builder.get_object("runWindow")
     self.runTreeView = builder.get_object("runTreeView")
     self.cancelBtn = builder.get_object("cancelRunBtn")
     self.assistant = assistant
     self.tlh = RunLoggingHandler(self.runTreeView)
     logger.addHandler(self.tlh)
     FORMAT = "%(levelname)s %(message)s"
     self.tlh.setFormatter(logging.Formatter(FORMAT))
     logger.setLevel(logging.DEBUG)
     self.store = Gtk.TreeStore(str)
     renderer = Gtk.CellRendererText()
     column = Gtk.TreeViewColumn("Log from current process", renderer, text=0)
     self.runTreeView.append_column(column)
     self.runTreeView.set_model(self.store)
Beispiel #5
0
 def __init__(self, parent, builder, gui_helper):
     self.parent = parent
     self.run_window = builder.get_object("runWindow")
     self.run_list_view = builder.get_object("runTreeView")
     self.debug_btn = builder.get_object("debugBtn")
     self.info_box = builder.get_object("infoBox")
     self.scrolled_window = builder.get_object("scrolledWindow")
     self.back_btn = builder.get_object("backBtn")
     self.main_btn = builder.get_object("mainBtn")
     self.tlh = RunLoggingHandler(self, self.run_list_view)
     self.gui_helper = gui_helper
     logger.addHandler(self.tlh)
     format_msg = "%(levelname)s %(message)s"
     self.tlh.setFormatter(logging.Formatter(format_msg))
     logger.setLevel(logging.DEBUG)
     is_log_file = add_log_file_handler(settings.LOG_FILE)
     if not is_log_file:
         logger_gui.warning("Could not create log file '{0}'.".format(
             settings.LOG_FILE))
     self.store = Gtk.ListStore(str)
     renderer = Gtk.CellRendererText()
     renderer.set_property('font', 'Liberation Mono')
     renderer.set_property('wrap_width', 750)
     renderer.set_property('wrap_mode', Gtk.WrapMode.WORD)
     column = Gtk.TreeViewColumn("Log from current process",
                                 renderer,
                                 markup=0)
     self.run_list_view.append_column(column)
     self.run_list_view.set_model(self.store)
     self.run_list_view.connect('row-activated', self.list_view_row_clicked)
     self.stop = threading.Event()
     self.dev_assistant_runner = None
     self.debug_logs = dict()
     self.debug_logs['logs'] = []
     self.link = None
     self.info_label = gui_helper.create_label(
         '<span color="#FFA500">In progress...</span>')
     self.info_box.pack_start(self.info_label, False, False, 12)
     self.project_canceled = False
     self.kwargs = {}
     self.current_main_assistant = None
     self.top_assistant = None
     self.close_win = False
     self.debugging = False
     self.thread = None
     sigint_handler.override()
Beispiel #6
0
 def logging(self, **kwargs):
     kwargs = self.proper_kwargs(**kwargs)
     for l in self._logging:
         handler_type, l_list = l.popitem()
         if handler_type == 'file':
             level, lfile = l_list
             expanded_lfile = self._format(lfile, **kwargs)
             # make dirs, create logger
             if not os.path.exists(os.path.dirname(expanded_lfile)):
                 os.makedirs(os.path.dirname(expanded_lfile))
             # add handler and formatter
             handler = logging.FileHandler(expanded_lfile, 'a+')
             formatter = logging.Formatter('%(asctime)-15s %(levelname)s - %(message)s')
             handler.setFormatter(formatter)
             handler.setLevel(getattr(logging, level.upper()))
             # register handler with the global logger
             logger.addHandler(handler)
         else:
             logger.warning('Unknown logger type {0}, ignoring.'.format(handler_type))
Beispiel #7
0
 def __init__(self, parent, builder, gui_helper):
     self.parent = parent
     self.run_window = builder.get_object("runWindow")
     self.run_list_view = builder.get_object("runTreeView")
     self.debug_btn = builder.get_object("debugBtn")
     self.info_box = builder.get_object("infoBox")
     self.scrolled_window = builder.get_object("scrolledWindow")
     self.back_btn = builder.get_object("backBtn")
     self.main_btn = builder.get_object("mainBtn")
     self.tlh = RunLoggingHandler(self, self.run_list_view)
     self.gui_helper = gui_helper
     logger.addHandler(self.tlh)
     format_msg = "%(levelname)s %(message)s"
     self.tlh.setFormatter(logging.Formatter(format_msg))
     logger.setLevel(logging.DEBUG)
     is_log_file = add_log_file_handler(settings.LOG_FILE)
     if not is_log_file:
         logger_gui.warning("Could not create log file '{0}'.".format(settings.LOG_FILE))
     self.store = Gtk.ListStore(str)
     renderer = Gtk.CellRendererText()
     renderer.set_property('font', 'Liberation Mono')
     renderer.set_property('wrap_width', 750)
     renderer.set_property('wrap_mode', Gtk.WrapMode.WORD)
     column = Gtk.TreeViewColumn("Log from current process", renderer, markup=0)
     self.run_list_view.append_column(column)
     self.run_list_view.set_model(self.store)
     self.run_list_view.connect('row-activated', self.list_view_row_clicked)
     self.stop = threading.Event()
     self.dev_assistant_runner = None
     self.debug_logs = dict()
     self.debug_logs['logs'] = []
     self.link = None
     self.info_label = gui_helper.create_label('<span color="#FFA500">In progress...</span>')
     self.info_box.pack_start(self.info_label, False, False, 12)
     self.project_canceled = False
     self.kwargs = {}
     self.current_main_assistant = None
     self.top_assistant = None
     self.close_win = False
     self.debugging = False
     self.thread = None
     sigint_handler.override()
Beispiel #8
0
 def logging(self, kwargs):
     # TODO: this doesn't seem to work, fix it...
     self.proper_kwargs('logging', kwargs)
     for l in self._logging:
         handler_type, l_list = l.popitem()
         if handler_type == 'file':
             level, lfile = l_list
             expanded_lfile = self._format(lfile, kwargs)
             # make dirs, create logger
             if not os.path.exists(os.path.dirname(expanded_lfile)):
                 os.makedirs(os.path.dirname(expanded_lfile))
             # add handler and formatter
             handler = logging.FileHandler(expanded_lfile, 'a+')
             formatter = logging.Formatter('%(asctime)-15s [%(event_type)] %(levelname)s - %(message)s')
             handler.setFormatter(formatter)
             handler.setLevel(getattr(logging, level.upper()))
             # register handler with the global logger
             logger.addHandler(handler)
         else:
             logger.warning('Unknown logger type {0}, ignoring.'.format(handler_type))
Beispiel #9
0
 def create_fresh_handler(cls):
     tlh = cls()
     logger.addHandler(tlh)
     return tlh
Beispiel #10
0
 def setup_method(self, method):
     self.log = io.StringIO() # Necessary (see class description)
     self.console_handler = DevassistantClHandler(self.log)
     self.console_handler.setFormatter(DevassistantClFormatter())
     self.console_handler.setLevel(logging.INFO)
     logger.addHandler(self.console_handler)
Beispiel #11
0
 def create_fresh_handler(cls):
     tlh = cls()
     logger.addHandler(tlh)
     return tlh
Beispiel #12
0
 def setup_method(self, method):
     self.log = io.StringIO()  # Necessary (see class description)
     self.console_handler = DevassistantClHandler(self.log)
     self.console_handler.setFormatter(DevassistantClFormatter())
     self.console_handler.setLevel(logging.INFO)
     logger.addHandler(self.console_handler)