Adding logging functionality
Dirty hack to make it work for me.