Put logging in backend

Fixes #323