Logs the probe result and raises on failure
9873
def report_and_raise(probe_name, probe_result, failure_msg):
    """"""
    log.info('%s? %s' % (probe_name, probe_result))
    if not probe_result:
        raise exceptions.ProbeException(failure_msg)
    else:
        return True
294053
@Override
  public void success()
  {
    _currentFailCount = 0;
    
    long now = CurrentTime.currentTime();

    if (_firstSuccessTime <= 0) {
      _firstSuccessTime = now;
    }
    
    // reset the connection fail recover time
    _dynamicFailRecoverTime = 1000L;
  }
740497
def log(message, level=None):
    """"""
    command = ['juju-log']
    if level:
        command += ['-l', level]
    if not isinstance(message, six.string_types):
        message = repr(message)
    command += [message[:SH_MAX_ARG]]
    # Missing juju-log should not cause failures in unit tests
    # Send log output to stderr
    try:
        subprocess.call(command)
    except OSError as e:
        if e.errno == errno.ENOENT:
            if level:
                message = "{}: {}".format(level, message)
            message = "juju-log: {}".format(message)
            print(message, file=sys.stderr)
        else:
            raise
537375
def after_request_log(target_url, opts, response)
      <<-LOG
Finish request #{opts[:method].upcase} #{target_url} with #{response.code}
#{response.body}
      LOG
    end
281019
def print_result(failed=False):
    
    message = "Version tag tests "
    if not failed:
        print("\n" + message + "passed!")
    else:
        print("\n" + message + "failed!")
    print("Passed : " + str(TEST_NUMBER - Failed) + "/" + str(TEST_NUMBER))
670391
function logError (failure, index) {
  index = index + 1

  if (index > 1) {
    log('\n\n')
  }

  log('  ' + index + ') ' + failure.description + ': ')

  if (failure.environment) {
    log(('(' + failure.environment + ')').grey)
  }

  log('\n\n')

  // Log the actual error message / stack trace / diffs
  var intend = 4 + String(index).length
  var error = formatError(failure.error, intend)

  if (!_empty(error.message)) {
    log(error.message + '\n')
  }

  if (!_empty(error.stack)) {
    log('\n' + error.stack.grey + '\n')
  }
}
23909
function(params, callback) {
      callback = callback || function(){};
      var t = this,
          errorText = '',
          router = Monitor.getRouter(),
          probeId = params.probeId,
          monitorProxy = t.incomingMonitorsById[probeId],
          firewall = t.get('firewall'),
          logCtxt = null,
          probe = null;

      // Already disconnected
      if (!monitorProxy || !monitorProxy.probe) {
        return callback(null);
      }

      // Get a good logging context
      probe = monitorProxy.probe;
      logCtxt = {
        probeClass: monitorProxy.get('probeClass'),
        initParams: monitorProxy.get('initParams'),
        probeId: probeId
      };

      // Called upon disconnect (internal or external)
      var onDisconnect = function(error) {
        if (error) {
          log.error(t.logId + 'probeDisconnect', error);
          return callback(error);
        }
        var duration = logCtxt.duration = Date.now() - probe.connectTime;
        probe.off('change', monitorProxy.probeChange);
        monitorProxy.probe = monitorProxy.probeChange = null;
        delete t.incomingMonitorsById[probeId];
        log.info(t.logId + 'probeDisconnected', logCtxt);
        stat.time(t.logId + 'probeDisconnected', duration);
        return callback(null);
      };

      // Disconnect from an internal or external probe
      if (probe && probe.connection) {
        router.disconnectExternal(probe.connection, probeId, onDisconnect);
      } else {
        router.disconnectInternal(probeId, onDisconnect);
      }
    }
377767
def probe_sync(self):
        """"""

        done = threading.Event()
        result = {}

        def probe_done(adapter_id, status, reason):
            result['success'] = status
            result['failure_reason'] = reason
            done.set()

        self.probe_async(probe_done)
        done.wait()

        return result
681048
def print_fatal_results(results, level=0):
    
    print_level(logger.critical, _RED + "[X] Fatal Error: %s", level, results.error)
799200
public function logSuccess()
  {
    $this->_lastSuccess = true;
    if ($this->_debug) {
      printf("[LoadBalancer] Success for %s<br />\n", $this->_connectionStrings[$this->_lastReturnedIndex] . (isset($this->_storageNames[$this->_lastReturnedIndex]) ? '|' . $this->_storageNames[$this->_lastReturnedIndex] : ''));
    }
    $hash = md5($this->_connectionStrings[$this->_lastReturnedIndex] . (isset($this->_storageNames[$this->_lastReturnedIndex]) ? '|' . $this->_storageNames[$this->_lastReturnedIndex] : ''));
    if (file_exists($this->_statusFilePrefix . $hash)) {
      unlink($this->_statusFilePrefix . $hash);
    }
  }
547168
def _log_fail_callback(driver, *args, **kwargs):
    

    try:
        logs = driver.get_browser_log(levels=[BROWSER_LOG_LEVEL_SEVERE])
        failure_message = 'There were severe console errors on this page: {}'.format(logs)
        failure_message = failure_message.replace('{', '{{').replace('}', '}}')  # Escape braces for error message
        driver.assertion.assert_false(
            logs,
            failure_message=failure_message
        )
    except (urllib2.URLError, socket.error, WebDriverException):
        # The session has ended, don't check the logs
        pass
898185
def run(self):
        
        if self.probes is None:
            self._stop = True
        while True:

            if self._stop:
                break

            self.probes_values = {
                instrument_name:
                    {probe_name: probe_instance.value for probe_name, probe_instance in probe.items()}
                for instrument_name, probe in self.probes.items()
                }

            self.updateProgress.emit(1)

            self.msleep(int(1e3*self.refresh_interval))
1027179
def print_logs(query, types=None):
    
    if query is None:
        return

    for run, log in query:
        print(("{0} @ {1} - {2} id: {3} group: {4} status: {5}".format(
            run.end, run.experiment_name, run.project_name,
            run.experiment_group, run.run_group, log.status)))
        print(("command: {0}".format(run.command)))
        if "stderr" in types:
            print("StdErr:")
            print((log.stderr))
        if "stdout" in types:
            print("StdOut:")
            print((log.stdout))
        print()
463109
function _failure(errors, test, result) {
  process.stdout.write('.'.red);
  failures.push({ errors: errors, test: test, result: result });
}
694033
def _log_and_raise_exception(msg, data, cls=FoursquareException):
  """"""
  data = u'{0}'.format(data)
  # We put data as a argument for log.error() so error tracking systems such
  # as Sentry will properly group errors together by msg only
  log.error(u'{0}: %s'.format(msg), data)
  raise cls(u'{0}: {1}'.format(msg, data))
1108791
def success(self, msg, *args, **kw):
        """"""
        if self.isEnabledFor(SUCCESS):
            self._log(SUCCESS, msg, args, **kw)
1128787
def probe(cls, resource, enable, disable, test, host, interval,
              http_method, http_response, threshold, timeout, url, window):
        
        params = {
            'host': host,
            'interval': interval,
            'method': http_method,
            'response': http_response,
            'threshold': threshold,
            'timeout': timeout,
            'url': url,
            'window': window
        }
        if enable:
            params['enable'] = True
        elif disable:
            params['enable'] = False
        if test:
            result = cls.call(
                'hosting.rproxy.probe.test', cls.usable_id(resource), params)
        else:
            result = cls.call(
                'hosting.rproxy.probe.update', cls.usable_id(resource), params)
            cls.display_progress(result)
        return result