simplify and improve log-api-pre