rewrite the logging