Commit dcd4d1ad authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

replace braces in logging statements

parent 5294a255
......@@ -262,9 +262,10 @@ def setup(config_file=None, logger_name=None, log_filename=None, log_root_dir=No
# log_format_console=log_format_console, date_format_console=date_format_console
# )
logger = OperationalLogger(**config)
logging.info('Logging output from: {}'.format(' '.join(sys.argv)))
logging.info('=' * 60)
logging.info('Logging output from: %s', ' '.join(sys.argv))
logging.info('Log writing to: %s', config['log_filename'])
logging.info('Process id {}, parent process id {}'.format(os.getpid(), os.getppid()))
logging.debug('Process id %d, parent process id %d', os.getpid(), os.getppid())
logging.info('-' * 60)
#if notify:
atexit.register(__exit_handler, logger, config['notify'])
......@@ -313,8 +314,8 @@ def log_shell(arg_list, raise_err=False, return_output=False, **kwargs):
return_output: (like subprocess.check_output) returns any output
from shell call instead of the exit code
"""
logging.info('Spawning child process from pid={}'.format(os.getpid()))
logging.info('Executing: {}'.format(' '.join(arg_list)))
logging.info('Spawning child process from pid=%d', os.getpid())
logging.info('Executing: %s', ' '.join(arg_list))
try:
my_name = os.path.basename(inspect.getfile(inspect.currentframe()))
for f in inspect.stack():
......@@ -332,10 +333,10 @@ def log_shell(arg_list, raise_err=False, return_output=False, **kwargs):
return_code = proc.wait()
if return_code:
if raise_err:
logging.error('{} failed with exit code {}'.format(' '.join(arg_list), return_code))
logging.error('%s failed with exit code %d', ' '.join(arg_list), return_code)
raise RuntimeError('{} failed with exit code {}'.format(' '.join(arg_list), return_code))
else:
logging.warning('{} failed with exit code {}'.format(' '.join(arg_list), return_code))
logging.warning('%s failed with exit code %d', ' '.join(arg_list), return_code)
return proc_output if return_output else return_code
except OSError as err:
logging.error('Error while executing %s: %s', ' '.join(arg_list), str(err))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment