Feature/external logging

Hi there, thought this might be helpful to some.
Please review and let me know if you see any problems, or have any particular ideas.
Thanks