add the error logger
add the encrypt function can be confiured.