rewrite logging