better API for logging