diff --git a/blivet/storage_log.py b/blivet/storage_log.py index 0609d0b..6ee694c 100644 --- a/blivet/storage_log.py +++ b/blivet/storage_log.py @@ -46,27 +46,32 @@ def log_method_return(d, retval): fmt_args = (spaces, classname, methodname, retval) log.debug(fmt, *fmt_args)
-def log_exception_info(log_func=log.debug, fmt_str=None, fmt_args=None): +def log_exception_info(log_func=log.debug, fmt_str=None, fmt_args=None, ignored=True): """Log detailed exception information.
:param log_func: the desired logging function :param str fmt_str: a format string for any additional message :param fmt_args: arguments for the format string :type fmt_args: a list of str
:param bool ignored: True if no action is taken regarding the exception Note: the logging function indicates the severity level of this exception according to the calling function. log.debug, the default, is the lowest level.
Note: If the ignored flag is set, each line of the exception information
is prepended with an 'IGNORED' prefix.
""" fmt_args = fmt_args or [] (_methodname, depth) = function_name_and_depth()
- spaces = depth * ' '
- log_func("%sCaught exception, continuing.", spaces)
- indent = depth * ' '
- prefix = 'IGNORED:' + indent if ignored else indent
I'm not a fan of this usage, but this is blivet and if it's acceptable there, I don't really mind.
- Chris