def log_printer_from_project(
    project,
    containers,
    monochrome,
    log_args,
    cascade_stop=False,
    event_stream=None,
):
    return LogPrinter(containers,
                      build_log_presenters(project.service_names, monochrome),
                      event_stream or project.events(),
                      cascade_stop=cascade_stop,
                      log_args=log_args)
def log_printer_from_project(
    project,
    containers,
    monochrome,
    log_args,
    cascade_stop=False,
    event_stream=None,
):
    return LogPrinter(
        containers,
        build_log_presenters(project.service_names, monochrome),
        event_stream or project.events(),
        cascade_stop=cascade_stop,
        log_args=log_args)
Beispiel #3
0
 def __wrapped__(
         project,
         containers,
         monochrome,
         log_args,
         cascade_stop=False,
         event_stream=None,
 ):
     return LogPrinter(
         containers,
         build_log_presenters(project.service_names, monochrome),
         event_stream or project.events(),
         cascade_stop=cascade_stop,
         output=buffer,
         log_args=log_args)
Beispiel #4
0
 def __wrapped__(
     project,
     containers,
     monochrome,
     log_args,
     cascade_stop=False,
     event_stream=None,
 ):
     return LogPrinter(containers,
                       build_log_presenters(project.service_names,
                                            monochrome),
                       event_stream or project.events(),
                       cascade_stop=cascade_stop,
                       output=buffer,
                       log_args=log_args)
Beispiel #5
0
 def get_logs(self, to_file=None):
     """Show output from containers.
     """
     containers = self._cmd.project.containers(
         service_names=self.options['SERVICE'], stopped=True)
     tail = None
     log_args = {'follow': False, 'tail': None, 'timestamps': False}
     with redirect_stderr(self._output):
         LogPrinter(
             containers,
             build_log_presenters(self._cmd.project.service_names,
                                  self.options['--no-color']),
             event_stream=self._cmd.project.events(
                 service_names=self.options['SERVICE']),
             output=self._output,
             log_args=log_args,
         ).run()
Beispiel #6
0
 def test_polychrome(self, mock_container):
     presenters = build_log_presenters(['foo', 'bar'], False)
     presenter = next(presenters)
     actual = presenter.present(mock_container, "this line")
     assert '\033[' in actual
Beispiel #7
0
 def test_monochrome(self, mock_container):
     presenters = build_log_presenters(['foo', 'bar'], True)
     presenter = next(presenters)
     actual = presenter.present(mock_container, "this line")
     assert actual == "web_1  | this line"
Beispiel #8
0
 def test_polychrome(self, mock_container):
     presenters = build_log_presenters(['foo', 'bar'], False)
     presenter = next(presenters)
     actual = presenter.present(mock_container, "this line")
     assert '\033[' in actual
Beispiel #9
0
 def test_monochrome(self, mock_container):
     presenters = build_log_presenters(['foo', 'bar'], True)
     presenter = next(presenters)
     actual = presenter.present(mock_container, "this line")
     assert actual == "web_1  | this line"
Beispiel #10
0
 def test_polychrome(self, mock_container):
     presenters = build_log_presenters(["foo", "bar"], False)
     presenter = next(presenters)
     actual = presenter.present(mock_container, "this line")
     assert "\033[" in actual