Save (part of) the log file from scripted module

As part of the output files of my scripted module, I would like to provide the whole python console history in a file. I thought of parsing the log file from Temp/Slicer for [Stream] lines, but I don’t know how to access it from within my module.
What’s possible to achieve my goal ?

take a look at the logging python module, it is straightforward.