- class svvamp.MyLog(log_identity='MYLOG', log_depth=0)[source]#
Object that can send simple log messages.
- log_depth#
Level of depth
- log_identity#
Name of the MyLog object. Will appear at the beginning of each log message.
- mylog(message='I am alive', detail_level=1)[source]#
Print a log message.
- Parameters:
message (str) – The message to display.
detail_level (int) – The level of detail of the message. The more it is, the less important is the message. Typically: * 1: Beginning of a method (except a simple get). * 2: Big steps of calculation. * 3: Computations inside loop (very verbose log). It is not recommended to use detail_level = 0 or lower.
Examples
>>> from svvamp.utils.my_log import MyLog >>> my_log_object = MyLog(log_identity="COMMENDATORE", log_depth=3) >>> my_log_object.mylog("Don Giovanni!", 1) COMMENDATORE: Don Giovanni!
- mylogm(message='Variable =', variable=None, detail_level=1)[source]#
Print a log message with the value of a variable, typically a matrix.
This method is well suited for a matrix because it skips to next line before printing the variable.
- Parameters:
Examples
>>> from svvamp.utils.my_log import MyLog >>> import numpy as np >>> my_log_object = MyLog(log_identity="MAGIC_SQUARE", log_depth=3) >>> my_log_object.mylogm("A nice matrix:", np.array([[2, 7, 6], [9, 5, 1], [4, 3, 8]])) MAGIC_SQUARE: A nice matrix: [[2 7 6] [9 5 1] [4 3 8]]
- mylogv(message='Variable =', variable=None, detail_level=1)[source]#
Print a log message with the value of a variable.
- Parameters:
Examples
>>> from svvamp.utils.my_log import MyLog >>> my_log_object = MyLog(log_identity="HITCHHIKER", log_depth=3) >>> my_log_object.mylogv("The answer is", 42) HITCHHIKER: The answer is 42