utils.py
def log(arguments, message):
    """
    Logging function that will both print and log an input message.
    :param arguments: ArgumentParser object containing 'log_dir' and 'experiment'.
    :param message: String containing the message to be printed and/or logged.
    """

    # Prints the message to console if verbose is set to True.
    if arguments.verbose:
        print(message)

    # Logs the message within a specific log file is defined.
    if arguments.log_dir != '':
        # Creates the directory for the log files.
        os.makedirs(arguments.log_dir, exist_ok=True)

        # Logs the message to the log file.
        print(message, file=open(os.path.join(arguments.log_dir, f"{arguments.experiment}_log.txt"), 'a'))

    Logging function that will both print and log an input message.
    :param arguments: ArgumentParser object containing 'log_dir' and 'experiment'.
    :param message: String containing the message to be printed and/or logged.
    
Logging function that will both print and log an input message.
Logging function that will both print and log an input message .
def log(arguments, message):
    if arguments.verbose:
        print(message)
    if arguments.log_dir != '':
        os.makedirs(arguments.log_dir, exist_ok=True)
        print(message, file=open(os.path.join(arguments.log_dir, f"{arguments.experiment}_log.txt"), 'a'))
def log ( arguments , message ) : if arguments . verbose : print ( message ) if arguments . log_dir != '' : os . makedirs ( arguments . log_dir , exist_ok = True ) print ( message , file = open ( os . path . join ( arguments . log_dir , f"{arguments.experiment}_log.txt" ) , 'a' ) )
Logging function that will both print and log an input message.
Logging function that will both print and log an input message .
"""
    Logging function that will both print and log an input message.
    :param arguments: ArgumentParser object containing 'log_dir' and 'experiment'.
    :param message: String containing the message to be printed and/or logged.
    """ # Prints the message to console if verbose is set to True. # Logs the message within a specific log file is defined. # Creates the directory for the log files. # Logs the message to the log file.
arguments
ArgumentParser object containing 'log_dir' and 'experiment'.
ArgumentParser object containing ' log_dir ' and ' experiment ' .
message
String containing the message to be printed and/or logged.
String containing the message to be printed and / or logged .