First attempt on logging

No idea if I have implemented it correctly...