Safe JS evaluation, with logging.