Minor improvement for api_error_log() function