Catch inspect error in logger
Inspect would in certain cases fail to find the line number. This
catches the exception and provides a basic name for the logger.
@@ -126,6 +126,7 @@ class LOG:
# [0] - _log()
# [1] - debug(), info(), warning(), or error()
# [2] - caller
+ try:
stack = inspect.stack()
# Record:
@@ -138,6 +139,10 @@ class LOG:
mod = inspect.getmodule(record[0])
module_name = mod.__name__ if mod else ''
name = module_name + ':' + record[3] + ':' + str(record[2])
+ except Exception:
+ # The location couldn't be determined
+ name = 'Mycroft'
+
func(cls.create_logger(name), *args, **kwargs)
