Error messages and log function.