Log and report any errors encountered by valgrind.
182527
def _check_valgrind(xml_file):
    """"""
    log(_("checking for valgrind errors..."))

    # Load XML file created by valgrind
    xml = ET.ElementTree(file=xml_file)

    # Ensure that we don't get duplicate error messages.
    reported = set()
    for error in xml.iterfind("error"):
        # Type of error valgrind encountered
        kind = error.find("kind").text

        # Valgrind's error message
        what = error.find("xwhat/text" if kind.startswith("Leak_") else "what").text

        # Error message that we will report
        msg = ["\t", what]

        # Find first stack frame within student's code.
        for frame in error.iterfind("stack/frame"):
            obj = frame.find("obj")
            if obj is not None and internal.run_dir in Path(obj.text).parents:
                file, line = frame.find("file"), frame.find("line")
                if file is not None and line is not None:
                    msg.append(f": ({_('file')}: {file.text}, {_('line')}: {line.text})")
                break

        msg = "".join(msg)
        if msg not in reported:
            log(msg)
            reported.add(msg)

    # Only raise exception if we encountered errors.
    if reported:
        raise Failure(_("valgrind tests failed; rerun with --log for more information."))
306095
def show_kernel_error(self, error):
        """"""
        # Replace end of line chars with <br>
        eol = sourcecode.get_eol_chars(error)
        if eol:
            error = error.replace(eol, '<br>')

        # Don't break lines in hyphens
        # From https://stackoverflow.com/q/7691569/438386
        error = error.replace('-', '&#8209')

        # Create error page
        message = _("An error ocurred while starting the kernel")
        kernel_error_template = Template(KERNEL_ERROR)
        self.info_page = kernel_error_template.substitute(
            css_path=self.css_path,
            message=message,
            error=error)

        # Show error
        self.set_info_page()
        self.shellwidget.hide()
        self.infowidget.show()

        # Tell the client we're in error mode
        self.is_error_shown = True
1355115
def log_error(self, callback, error=None):
        
        print("Uncaught error during callback: {}".format(callback))
        print("Error: {}".format(error))
1118976
def send_errors_to_logging():
    """"""
    error_output = vtk.vtkStringOutputWindow()
    error_win = vtk.vtkOutputWindow()
    error_win.SetInstance(error_output)
    obs = Observer()
    return obs.observe(error_output)
960957
def __get_valgrind_params(self):
        
        valgrind = []
        if self.valgrind:
            valgrind.extend(['valgrind'])
            if self.valgrind == 'memcheck':
                valgrind.extend(['--tool=memcheck', '--leak-check=full'])
                if self.valgrind_track_origins:
                    valgrind.extend(['--track-origins=yes'])
                if self.valgrind_console:
                    # just dump the default output, which is text dumped to console
                    valgrind.extend([])
                elif self.valgrind_xml:
                    valgrind.extend([
                        '--xml=yes',
                        '--xml-file=' + LogManager.get_testcase_logfilename(
                            self.name + '_valgrind_mem.xml', prepend_tc_name=True)
                    ])
                else:
                    valgrind.extend([
                        '--log-file=' + LogManager.get_testcase_logfilename(
                            self.name + '_valgrind_mem.txt')
                    ])

            elif self.valgrind == 'callgrind':
                valgrind.extend([
                    '--tool=callgrind',
                    '--dump-instr=yes',
                    '--simulate-cache=yes',
                    '--collect-jumps=yes'])
                if self.valgrind_console:
                    # just dump the default output, which is text dumped to console
                    valgrind.extend([])
                elif self.valgrind_xml:
                    valgrind.extend([
                        '--xml=yes',
                        '--xml-file=' + LogManager.get_testcase_logfilename(
                            self.name + '_valgrind_calls.xml', prepend_tc_name=True)
                    ])
                else:
                    valgrind.extend([
                        '--callgrind-out-file=' + LogManager.get_testcase_logfilename(
                            self.name + '_valgrind_calls.data')
                    ])
            elif self.valgrind == 'massif':
                valgrind.extend(['--tool=massif'])
                valgrind.extend([
                    '--massif-out-file=' + LogManager.get_testcase_logfilename(
                        self.name + '_valgrind_massif.data')
                    ])
            # this allows one to specify misc params to valgrind,
            # eg. "--threshold=0.4" to get some more data from massif
            if self.valgrind_extra_params != '':
                valgrind.extend(self.valgrind_extra_params.split())

        return valgrind
79379
function reportInfo(errorHandler, msg) {

        if (errorHandler && errorHandler.info && errorHandler.info(msg))
            throw msg;

    }
557966
def log_error(*error, cause=None):
    
    thread_id = threading.current_thread().ident
    text = " ".join(error)
    if cause:
        text += " due to " + str(cause)

    logger = get_logger()
    logger.error(LOG_THREAD_FORMAT.format(thread_id, text))
861579
def log(self, statement):
        ''''''
        global DEBUG
        time_ms = 1000 * time.time()
        if DEBUG:
            total_time_ms = time_ms - self._start_time_ms_
            lap_time_ms = time_ms - self._last_time_ms_
            sys.stderr.write('%6.f (%6.f ms) %s\n' % (
                total_time_ms, lap_time_ms, statement))
        self._last_time_ms_ = time_ms
184170
def error(self, msg, repeat_at_end=True):
        """"""
        print(msg, file=sys.stderr)
        if repeat_at_end:
            self.error_log.append(msg)
817856
public static function popErrorMask()
    {
        $lastMask = array_pop(self::$logLevelStack);
        error_reporting($lastMask[0]);
        self::$logMask = $lastMask[1];
    }
609337
protected function logError()
  {
    $args   = func_get_args();
    $format = array_shift($args);

    foreach ($args as &$arg)
    {
      if (!is_scalar($arg)) $arg = var_export($arg, true);
    }

    if ($this->haltOnError) throw new \BuildException(vsprintf($format, $args));

    if (sizeof($args)==0)
    {
      $this->log($format, \Project::MSG_ERR);
    }
    else
    {
      $this->log(vsprintf($format, $args), \Project::MSG_ERR);
    }
  }
1244674
def error(self, line_number, offset, text, check):
        """"""
        code = super(_Report, self).error(line_number, offset, text, check)
        if code:
            self.errors.append((line_number, offset + 1, code, text, check))
31676
def log(self, *msg, sep='', end='\n', flush=False):
        """"""
        if not self.quiet:
            print(*msg, sep=sep, end=end, flush=flush)
1300017
public synchronized void logAndClearReportedErrors() {
    for(ParameterException e : getErrors()) {
      if(LOG.isDebugging()) {
        LOG.warning(e.getMessage(), e);
      }
      else {
        LOG.warning(e.getMessage());
      }
    }
    clearErrors();
  }
711734
def log_error(self, msg, *args):
        """"""
        if self._logger is not None:
            self._logger.error(msg, *args)
        else:
            print(msg % args)
140651
def log_debug(func, *args, **kwargs):
    '''  '''
    logging.debug('Starting "%s" in thread %s...', func.__name__, current_thread())
    results = func(*args, **kwargs)
    logging.debug('Successfully finished "%s" in thread %s.', func.__name__, current_thread())
    return results
603468
function logError(log, err) {
    let debug = log.debug || log.trace || log.log;
    if (err.Fault) {
        log.error(err.Fault);
        if (err.response && err.response.request) {
            log.error("URL: " + err.response.request.href);
        }
        if (err.body) debug(err.body);
    } else {
        log.error(err.stack ? err.stack : err);
    }
}