def run_log_printer(containers, monochrome=False): r, w = os.pipe() reader, writer = os.fdopen(r, 'r'), os.fdopen(w, 'w') printer = LogPrinter(containers, output=writer, monochrome=monochrome) printer.run() writer.close() return reader.read()
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 __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)
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()
def run_log_printer(containers, monochrome=False): output = six.StringIO() LogPrinter(containers, output=output, monochrome=monochrome).run() return output.getvalue()
def logs(self, project, projectname, servicenames): containers = project.containers(service_names=servicenames, stopped=True) print('Attaching to', ', '.join(c.name for c in containers)) LogPrinter(containers, attach_params={'logs': True}).run()