Tools for debug¶
INFO_DEBUG¶
Show info debug, show in message box.
If you have any problem in your code, you can open issue in this project, always copy the information of INFO_DEBUG in your ticket.
import easymacro as app
def info():
app.msgbox(INFO_DEBUG)
return
Show in shell.
import easymacro as app
def info():
app.debug(INFO_DEBUG)
return
Log error¶
Show error message in shell.
import easymacro as app
def error():
msg = 'My error 500'
app.error(msg)
return
Log debug¶
Show debug message in shell.
import easymacro as app
def error():
msg = 'Verify this data...'
app.debug(msg)
return
Log info¶
Show info message in shell.
import easymacro as app
def error():
msg = 'Start process...'
app.info(msg)
return
Log to file¶
Save log to file, automatic add date and time.
import easymacro as app
def log():
app.save_log('/home/mau/log.txt', 'PyUNO')
app.save_log('/home/mau/log.txt', app.INFO_DEBUG)
return
Message box¶
Show any data in message box
import easymacro as app
def message():
msg = 'Please, save the planet'
app.msgbox(msg)
msg = ('one', 2, 'three')
app.msgbox(msg)
msg = {'name': 'Teresa'}
app.msgbox(msg)
app.msgbox(app)
return
Catch exceptions¶
Sometimes, for difficult errors, you can catch exceptions.
import easymacro as app
@app.catch_exception
def test():
r = 1 / 0
return
And not, not used you this function in production.
Call MRI¶
MRI is the better extension for debug any object in LibreOffice, you need install before call it.
import easymacro as app
def error():
obj = app.active
app.mri(obj)
return