refactor logError to elog