extract logging to a module