Logs args of LogPrinter as a dictionary
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
This commit is contained in:
parent
9b36dc5c54
commit
038da4eea3
4 changed files with 23 additions and 25 deletions
|
|
@ -337,16 +337,19 @@ class TopLevelCommand(DocoptCommand):
|
|||
containers = project.containers(service_names=options['SERVICE'], stopped=True)
|
||||
|
||||
monochrome = options['--no-color']
|
||||
follow = options['--follow']
|
||||
timestamps = options['--timestamps']
|
||||
tail = options['--tail']
|
||||
if tail is not None:
|
||||
if tail.isdigit():
|
||||
tail = int(tail)
|
||||
elif tail != 'all':
|
||||
raise UserError("tail flag must be all or a number")
|
||||
log_args = {
|
||||
'follow': options['--follow'],
|
||||
'tail': tail,
|
||||
'timestamps': options['--timestamps']
|
||||
}
|
||||
print("Attaching to", list_containers(containers))
|
||||
LogPrinter(containers, monochrome=monochrome, follow=follow, timestamps=timestamps, tail=tail).run()
|
||||
LogPrinter(containers, monochrome=monochrome, log_args=log_args).run()
|
||||
|
||||
def pause(self, project, options):
|
||||
"""
|
||||
|
|
@ -672,8 +675,8 @@ class TopLevelCommand(DocoptCommand):
|
|||
|
||||
if detached:
|
||||
return
|
||||
log_printer = build_log_printer(to_attach, service_names, monochrome, cascade_stop,
|
||||
follow=True)
|
||||
log_args = {'follow': True}
|
||||
log_printer = build_log_printer(to_attach, service_names, monochrome, cascade_stop, log_args)
|
||||
print("Attaching to", list_containers(log_printer.containers))
|
||||
log_printer.run()
|
||||
|
||||
|
|
@ -771,13 +774,13 @@ def run_one_off_container(container_options, project, service, options):
|
|||
sys.exit(exit_code)
|
||||
|
||||
|
||||
def build_log_printer(containers, service_names, monochrome, cascade_stop, follow):
|
||||
def build_log_printer(containers, service_names, monochrome, cascade_stop, log_args):
|
||||
if service_names:
|
||||
containers = [
|
||||
container
|
||||
for container in containers if container.service in service_names
|
||||
]
|
||||
return LogPrinter(containers, monochrome=monochrome, cascade_stop=cascade_stop, follow=follow)
|
||||
return LogPrinter(containers, monochrome=monochrome, cascade_stop=cascade_stop, log_args=log_args)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue