Share and Money Management 0.18devel
|
This module provides an own logger class as well as specific functions to improve Pythons logging facility. More...
Classes | |
class | ExceptionFormatter |
Extended formatter to include more exception details automatically. More... | |
class | StringHandler |
Stores the log records as a list of strings. More... | |
Functions | |
def | init (filename="smm.log", encoding="utf-8", level=None) |
Initialise the logging facility. More... | |
def | deinit () |
Reactivate system exception handler. More... | |
def | getBufferAsList (clean=True) |
Returns all buffered messages. More... | |
def | getBufferAsString (clean=True) |
Returns all buffered messages. More... | |
def | flush () |
Empty the buffer. More... | |
def | installExceptionHandler () |
Install own exception handler. More... | |
def | deinstallExceptionHandler () |
Restore the original exception handler from sys.__excepthook__. More... | |
def | exceptionHandler (exc_type, exc_value, exc_tb) |
Logs detailed information about uncaught exceptions. More... | |
def | getMessage (self) |
Return the message for this LogRecord. More... | |
Variables | |
stringLoggerInstance = None | |
Reference to the active StringHandler instance. More... | |
This module provides an own logger class as well as specific functions to improve Pythons logging facility.
The SMM GUI uses the python logging instance with three log handler attached.
The first handler (StringHandler) is used to cache messages later displaying calling getBufferAsList() or getBufferAsString().
The second handler (StreamHandler) to print error messages to sys.stderr
.
The third handler (RotatingFileHandler) writes all messages into a file. This behaviour is useful to store logged exceptions permanently.
def gui.log.deinit | ( | ) |
Reactivate system exception handler.
References gui.log.deinstallExceptionHandler().
def gui.log.deinstallExceptionHandler | ( | ) |
Restore the original exception handler from sys.__excepthook__.
Referenced by gui.log.deinit().
def gui.log.exceptionHandler | ( | exc_type, | |
exc_value, | |||
exc_tb | |||
) |
Logs detailed information about uncaught exceptions.
The exception information will be cleared after that.
exc_type | Type of the exception (normally a class object) |
exc_value | The "value" of the exception |
exc_tb | Call stack of the exception |
def gui.log.flush | ( | ) |
Empty the buffer.
Referenced by tests.test_objects.TestObjects.test_Position_objects().
def gui.log.getBufferAsList | ( | clean = True | ) |
Returns all buffered messages.
clean | Clean the internal message buffer |
def gui.log.getBufferAsString | ( | clean = True | ) |
Returns all buffered messages.
clean | Clean the internal message buffer |
def gui.log.getMessage | ( | self | ) |
Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied arguments with the message.
def gui.log.init | ( | filename = "smm.log" , |
|
encoding = "utf-8" , |
|||
level = None |
|||
) |
Initialise the logging facility.
Initialise and configure the logging itself as well as the handlers described above.
Our own exception handler will be installed finally.
The file logger won't be instantiated if not file name is given.
filename | Name of the log file |
encoding | Encoding of the log file |
level | Verbosity of messages written in log file e.g. "INFO" |
References gui.log.installExceptionHandler().
def gui.log.installExceptionHandler | ( | ) |
Install own exception handler.
Referenced by gui.log.init().
gui.log.stringLoggerInstance = None |
Reference to the active StringHandler instance.