Added support for logging the print statements and the select statements

Pull request for issue #33

Hi Jake,

Here is a first attempt to implement the logging feature. Let me know if it needs any improvements.

Thanks,

Niek.