Implementing Python logging