Logging with stats feature