sregistry/main/google_build/logs.py
def logs(self, name=None):
    '''return logs for a particular container. The logs file is equivalent to
       the name, but with extension .log. If there is no name, the most recent
       log is returned.

       Parameters
       ==========
       name: the container name to print logs for.

    '''
    content = None
    results = self._list_logs()
    print(results)

    # If we are searching for a name
    if name is not None:
        for result in results:

            matches = False

            # Case 1: the name is in the storage path
            if name in result.name:
                matches=True

            # Case 2: match in metadata
            for key,val in result.metadata.items():
                if name in val:
                    matches = True

            if matches is True:
                content = self._print_log(result.name)  

    # Otherwise return the last
    else:

        if len(results) > 0:
            latest = results[0]
 
            # Get the most recent
            for result in results:
                if result.time_created >= latest.time_created:
                    latest = result                   
            content = self._print_log(result.name)  

    return content
def logs(self, name=None):
    '''return logs for a particular container. The logs file is equivalent to
       the name, but with extension .log. If there is no name, the most recent
       log is returned.

       Parameters
       ==========
       name: the container name to print logs for.

    '''
    content = None
    results = self._list_logs()
    print(results)

    # If we are searching for a name
    if name is not None:
        for result in results:

            matches = False

            # Case 1: the name is in the storage path
            if name in result.name:
                matches=True

            # Case 2: match in metadata
            for key,val in result.metadata.items():
                if name in val:
                    matches = True

            if matches is True:
                content = self._print_log(result.name)  

    # Otherwise return the last
    else:

        if len(results) > 0:
            latest = results[0]
 
            # Get the most recent
            for result in results:
                if result.time_created >= latest.time_created:
                    latest = result                   
            content = self._print_log(result.name)  

    return content
def logs ( self , name = None ) : content = None results = self . _list_logs ( ) print ( results ) # If we are searching for a name if name is not None : for result in results : matches = False # Case 1: the name is in the storage path if name in result . name : matches = True # Case 2: match in metadata for key , val in result . metadata . items ( ) : if name in val : matches = True if matches is True : content = self . _print_log ( result . name ) # Otherwise return the last else : if len ( results ) > 0 : latest = results [ 0 ] # Get the most recent for result in results : if result . time_created >= latest . time_created : latest = result content = self . _print_log ( result . name ) return content
return logs for a particular container. The logs file is equivalent to
       the name, but with extension .log. If there is no name, the most recent
       log is returned.

       Parameters
       ==========
       name: the container name to print logs for.
return logs for a particular container . The logs file is equivalent to the name but with extension . log . If there is no name the most recent log is returned .