1616import shutil
1717import tempfile
1818import time
19-
20- from .engine import BuildError , ContainerEngineException , ImageLoadError
2119from urllib .parse import urlparse
20+
2221import escapism
2322from pythonjsonlogger import jsonlogger
2423
3837 RBuildPack ,
3938)
4039from . import contentproviders
40+ from .engine import BuildError , ContainerEngineException , ImageLoadError
4141from .utils import ByteSpecification , chdir
4242
4343
@@ -629,9 +629,12 @@ def wait_for_container(self, container):
629629 Displaying logs while it's running
630630 """
631631
632+ last_timestamp = None
632633 try :
633- for line in container .logs (stream = True ):
634- self .log .info (line .decode ("utf-8" ), extra = dict (phase = "running" ))
634+ for line in container .logs (stream = True , timestamps = True ):
635+ line = line .decode ("utf-8" )
636+ last_timestamp , line = line .split (" " , maxsplit = 1 )
637+ self .log .info (line , extra = dict (phase = "running" ))
635638
636639 finally :
637640 container .reload ()
@@ -646,9 +649,9 @@ def wait_for_container(self, container):
646649 "Container finished running.\n " .upper (), extra = dict (phase = "running" )
647650 )
648651 # are there more logs? Let's send them back too
649- late_logs = container .logs ().decode ("utf-8" )
652+ late_logs = container .logs (since = last_timestamp ).decode ("utf-8" )
650653 for line in late_logs .split ("\n " ):
651- self .log .info (line + "\n " , extra = dict (phase = "running" ))
654+ self .log .debug (line + "\n " , extra = dict (phase = "running" ))
652655
653656 container .remove ()
654657 if exit_code :
0 commit comments