Default Log Messages¶
Importing¶
from objlog.LogMessages import Info, Debug, Warn, Error, Fatal, PythonExceptionMessage
Info¶
log.log(Info("Hello, world!"))
Description: Logs an informational message.
color: Green
Debug¶
log.log(Debug("Hello, world!"))
Description: Logs a debug message.
color: Blue
Warn¶
log.log(Warn("Hello, world!"))
Description: Logs a warning message.
color: Yellow
Error¶
log.log(Error("Hello, world!"))
Description: Logs an error message.
color: Red
Fatal¶
log.log(Fatal("Hello, world!"))
Description: Logs a fatal message.
color: Pink
PythonExceptionMessage¶
try:
raise Exception("Hello, world!")
except Exception as e:
log.log(e)
Description: An object wrapping a Python exception, not to be used directly, but to interact with exceptions logged to the LogNode.
color: Red
Note: When getting the exception from the LogNode, it will be wrapped in a
PythonExceptionMessageobject. which is a subclass ofLogMessage. to get the original exception, you can use the.exceptionattribute of thePythonExceptionMessageobject. Any attributes or methods of a LogMessage can be used on aPythonExceptionMessageobject, and the original exception object can be accessed using the.exceptionattribute.