Add guard for element instanceof check when logging.