How to use the sen.util.log_traceback function in sen

To help you get started, we’ve selected a few sen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TomasTomecek / sen / tests / test_util.py View on Github external
    @log_traceback
    def f():
        pass
    caplog.set_level(logging.DEBUG)
github TomasTomecek / sen / sen / tui / ui.py View on Github external
def _run(worker, f, *args, **kwargs):
        # TODO: do another wrapper to wrap notify exceptions and show them
        f = log_traceback(f)
        worker.submit(f, *args, **kwargs)
github TomasTomecek / sen / sen / tui / commands.py View on Github external
@log_traceback
def search(ui, oldfooter, edit_widget, text_input):
    logger.debug("%r %r", edit_widget, text_input)
    if text_input.endswith("\n"):
        # TODO: implement incsearch
        #   - match needs to be highlighted somehow, not with focus though
        ui.mainframe.prompt_bar = None
        ui.mainframe.set_footer(oldfooter)
        try:
            ui.current_buffer.find_next(text_input[:-1])
        except NotifyError as ex:
            logger.error(repr(ex))
            ui.notify_message(str(ex), level="error")
        ui.mainframe.set_focus("body")
        ui.reload_footer()
github TomasTomecek / sen / sen / tui / commands.py View on Github external
@log_traceback
def filter(ui, oldfooter, edit_widget, text_input):
    logger.debug("%r %r", edit_widget, text_input)
    if text_input.endswith("\n"):
        ui.mainframe.prompt_bar = None
        ui.mainframe.set_footer(oldfooter)
        try:
            ui.current_buffer.filter(text_input[:-1])
        except NotifyError as ex:
            logger.error(repr(ex))
            ui.notify_message(str(ex), level="error")
        ui.mainframe.set_focus("body")
        ui.reload_footer()
github TomasTomecek / sen / sen / tui / ui.py View on Github external
        @log_traceback
        def clear_notification(*args, **kwargs):
            # the point here is the log_traceback
            self.remove_widget(widget, message=message)
github TomasTomecek / sen / sen / tui / commands / ui.py View on Github external
    @log_traceback
    def do(self, fn, *args, **kwargs):
        try:
            fn(*args, **kwargs)
        except NotifyError as ex:
            logger.error(repr(ex))
            self.ui.notify_message(str(ex), level="error")
        except Exception as ex:
            logger.error(repr(ex))
            self.ui.notify_message("Command failed: %s" % str(ex), level="error")
            raise
github TomasTomecek / sen / sen / tui / commands / ui.py View on Github external
@log_traceback
def run_command_callback(ui, docker_object, edit_widget, text_input):
    logger.debug("%r %r", edit_widget, text_input)
    if "\n" in text_input:
        inp = text_input.strip()
        inp = inp.replace("\n", "")
        # first restore statusbar and then run the command
        ui.prompt_bar = None
        ui.set_focus("body")
        try:
            ui.run_command(inp, docker_object=docker_object)
        except NoSuchCommand as ex:
            logger.info("non-existent command initiated: %r", inp)
            ui.notify_message(str(ex), level="error")
        except Exception as ex:
            logger.info("command %r failed: %r", inp, ex)
            ui.notify_message("Error while running command '{}': {}".format(
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
        @log_traceback
        def realtime_updates():
            g = self.docker_container.stats().response
            while True:
                try:
                    update = next(g)
                except Exception as ex:
                    if "Timeout" in ex.__class__.__name__:
                        logger.info("timeout when reading stats: %r", ex)
                        g = self.docker_container.stats().response
                        continue
                    logger.error("error while getting stats: %r", ex)
                    self.ui.notify_message("Error while getting stats: %s" % ex, level="error")
                    # TODO: if debug raise
                    break

                if self.stop.is_set():
github TomasTomecek / sen / sen / tui / statusbar.py View on Github external
        @log_traceback
        def clear_notification(*args, **kwargs):
            # the point here is the log_traceback
            self.remove_widget(widget, message=message)