Link to example code on paste been below:
This example creates a temp log file. The program will echo all lines of commands to this log file. The log file is then fed in to the yad --text info window.
Complete code is on paste bin here: https://pastebin.com/6iCvTaZ4