Commit 34f24e21 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

add convenience wrappers to log_shell

parent 935048b1
......@@ -56,8 +56,7 @@ def __exit_handler(logger, notify):
class OperationalLogger:
"""Main class for Operational Logging."""
"""Main class for Operational Logging."""
DEFAULT_LOG_FORMAT_FILE = '[%(asctime)s][%(levelname)5s][p%(process)d][%(filename)s:%(lineno)d] %(message)s'
DEFAULT_LOG_FORMAT_CONSOLE = '%(asctime)s (%(levelname)5s) [%(filename)s:%(lineno)d] %(message)s'
......@@ -303,6 +302,21 @@ def long_debug(message):
long_log(logging.DEBUG, message)
def call(arg_list, **kwargs):
"""Wrapper to log_shell to make it synonymous with subprocess.call()."""
return log_shell(arg_list, **kwargs)
def check_call(arg_list, **kwargs):
"""Wrapper to log_shell to make it synonymous with subprocess.check_call()."""
return log_shell(arg_list, raise_err=True, **kwargs)
def check_output(arg_list, **kwargs):
"""Wrapper to log_shell to make it synonymous with subprocess.check_output()."""
return log_shell(arg_list, raise_err=True, return_output=True, **kwargs)
def log_shell(arg_list, raise_err=False, return_output=False, **kwargs):
"""Pass arg_list to a subprocess call and log all output.
......
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