smpl.debug
Simplified python debuging.
|
Prints the message |
|
Just like |
|
Gets the current filename and the current linenumber within it. |
|
Prints the message |
|
Just like |
|
Returns true only one time |
|
Saves |
|
Saves the current keys from |
|
Saves the current values from |
Functions
- smpl.debug.file(key, value, level=0, times=- 1, seperator=';', _print=True, _back=0, filename='debug.csv')[source]
Prints the message
msgif level > debug_level to filefilename
- smpl.debug.file1(_key, _value, level=0, times=1, _back=0, **kwargs)[source]
Just like
file()buttimesset to 1.
- smpl.debug.get_line_number_file(split=True, _back=0)[source]
Gets the current filename and the current linenumber within it.
- Parameters
- splitbool
Indicates whenever the folders above of the file should be included in the returned filename.
- _backint
Number of stack/frames to go back.
- Returns
- filenumberint
First element in the return array
- filenamestr
Second element in the return array
- smpl.debug.msg(msg, tag='', level=0, times=- 1, line_=False, _back=0, **kwargs)[source]
Prints the message
msgif level > debug_level and always returns the msg.- Parameters
- tagstr
Sets a tag to be printed for the debug message.
- levelint
Debug level.
- timesint
How often should the message be printed if the function gets called multiple times (e.g. in a loop).
- _linebool
Print the current line in the python source.
- _backint
Number of stack/frames to go back.
Examples
>>> msg("hi", level = -9999) DBG::debug.py:...: hi 'hi' >>> msg("hi") 'hi'
- smpl.debug.msg1(_msg, tag='', level=0, times=1, line_=False, _back=0, **kwargs)[source]
Just like
msg()buttimesset to 1.
- smpl.debug.once(_back=0)[source]
Returns true only one time
Examples
>>> for i in range(10): ... if once(): ... print(i) 0
- smpl.debug.table(key, value, level=0, times=- 1, seperator=';', _print=False, _back=0, filename='debug_table.csv')[source]
Saves
key:valueinfilename.