Utils¶
@monitor¶
Type: Decorator
Description: Monitor a function, if a python exception is raised, it will be logged, and the function will return None.
Parameters:
log_nodeType:
LogNodeDefault: Required
Description: The log node to use for logging any exceptions that occur.
raise_exceptionsType:
boolDefault:
FalseDescription: If True, the exception will be raised after logging. If False, the exception will be suppressed.
exit_on_exceptionType:
boolDefault:
FalseDescription: If True, the program will raise a SystemExit after logging the exception. If False, the program will continue running.
Note: This parameter overrides
raise_exceptionsand will always close the program if an exception is raised without raising it. Also, this parameter is not recommended for internal code, and should only be used in user-facing code.
load()¶
Type: Function
Description: Load a LogNode from a file.
Parameters:
fileType:
strDefault: Required
Description: The path to the file to load the LogNode from.
Note: The file must be a
.lgndpickle file containing a LogNode object. ATypeErroris raised if the file does not contain a LogNode, and aValueErroris raised if the saved LogNode’s major version is incompatible with the installed version of ObjLog.