Logging rewrite, from scratch