Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
OperationalLogging
Commits
34f24e21
Commit
34f24e21
authored
Sep 01, 2015
by
Trevor Cappallo
Browse files
add convenience wrappers to log_shell
parent
935048b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
lib/OperationalLogger.py
lib/OperationalLogger.py
+16
-2
No files found.
lib/OperationalLogger.py
View file @
34f24e21
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment