Callback that attempts to send pending logs before termination.
559832
def _main_thread_terminated(self):
        """"""
        if not self.is_alive:
            return

        if not self._queue.empty():
            print(
                "Program shutting down, attempting to send %d queued log "
                "entries to Stackdriver Logging..." % (self._queue.qsize(),),
                file=sys.stderr,
            )

        if self.stop(self._grace_period):
            print("Sent all pending logs.", file=sys.stderr)
        else:
            print(
                "Failed to send %d pending logs." % (self._queue.qsize(),),
                file=sys.stderr,
            )
117188
def notify_exception(self, exception, run_done_callbacks=True):
        '''  '''
        logger.error("%s : %s" % (exception.__class__.__name__, str(exception)))
        self._exception = exception
        if self.is_running(True):
            # wait for a short 5 seconds for it to finish
            for _cnt in range(0, 5):
                if not self._cancel():
                    time.sleep(1)
                else:
                    break

        self.notify_done(error=True, run_done_callbacks=run_done_callbacks)
402140
public void log(Priority priority, Object message, Throwable t) {
        if (repository.isDisabled(priority.level)) {
            return;
        }
        if (priority.isGreaterOrEqual(this.getEffectiveLevel()))
            forcedLog(FQCN, priority, message, t);
    }
719663
def immediately_dump_pending(desc, msg, location)
      erase_current_line
      output.puts yellow("PENDING SPEC:") + " #{desc} (#{msg})"
      output.puts "  Called from #{location}"
      output.puts
    end
195592
def callback(self, filename, lines, **kwargs):
        """"""
        timestamp = self.get_timestamp(**kwargs)
        if kwargs.get('timestamp', False):
            del kwargs['timestamp']
        

        for line in lines:
            try:
                import warnings
                with warnings.catch_warnings():
                    warnings.simplefilter('error')
                    m = self.format(filename, line, timestamp, **kwargs)
                    self.logger.debug("Sending message " + m)
                    self.conn.send(destination=self.queue, body=m)    

            except Exception, e:
                self.logger.error(e)
                try:
                    raise TransportException(e)
                except AttributeError:
                    raise TransportException('Unspecified exception encountered')
306176
def warn(self, msg, *args, **kwargs):
        """"""
        self.log(self.WARN, msg, *args, **kwargs)
337443
def alert(self, msg):
        """"""
        if self.event_callback is not None:
            try:
                self.event_callback(msg)
            except Exception as exception:  # pylint: disable=broad-except
                _LOGGER.exception(exception)

        if self.persistence:
            self.persistence.need_save = True
1084509
def __notify(self):
        
        if self.__callback is not None:
            try:
                self.__callback(
                    self._done_event.data,
                    self._done_event.exception,
                    self.__extra,
                )
            except Exception as ex:
                self._logger.exception("Error calling back method: %s", ex)
1194938
def gevent_wait_callback(conn, timeout=None):
    """"""
    while 1:
        state = conn.poll()
        if state == extensions.POLL_OK:
            break
        elif state == extensions.POLL_READ:
            wait_read(conn.fileno(), timeout=timeout)
        elif state == extensions.POLL_WRITE:
            wait_write(conn.fileno(), timeout=timeout)
        else:
            raise OperationalError(
                "Bad result from poll: %r" % state)
1297413
function cb(err) {
        if (callback) {
            if (err) return callback(err);
            callback(null, rec);
        }
        callback = null;
        if (!err) {
            that.emit('logged', rec);
        }
    }
125027
function flushEvents() {
  var tmp = PENDING_QUEUE;
  PENDING_QUEUE = [];
  for (var i = 0; i < tmp.length; i++) {
    clientObj.send('log', tmp[i].item, tmp[i].fn);
  }
}
83106
def __recv_log_set_exc_and_wait(self, msg, level=None, wait_seconds=CONN_RETRY_DELAY_SECONDS):
        """"""
        logger.log(
            ((logging.DEBUG if self.__recv_exc else logging.ERROR) if level is None else level),
            msg,
            exc_info=DEBUG_ENABLED
        )
        self.__recv_exc = exc_info()[1]
        self.__end.wait(wait_seconds)
370831
def __send_exc_clear(self, log_if_exc_set=None):
        
        if not (log_if_exc_set is None or self.__send_exc is None):
            logger.info(log_if_exc_set)
        self.__send_exc_time = None
        self.__send_exc = None
802774
def worker_logfinish(self, node, nodeid, location):
        """"""
        self.config.hook.pytest_runtest_logfinish(nodeid=nodeid, location=location)
1262041
function Pending(runner) {

  runner.on('start', function(){
    console.log('* ')
    console.log('*********************');
    console.log('*** Pending tests ***');
    console.log('*********************');
    console.log('* ')
  });

  var scope = [];

  runner.on('pending', function(test){
    var current = [test]
      , parent = test.parent
    ;
    // stack suites
    while( !!parent ){
      current.unshift(parent)
      parent = parent.parent;
    }
    // print titles
    current.forEach(function(val, key){
      if( val != scope[key] ){
        while( scope.length > key ){
          scope.pop()
        }
        console.log( '* ' + Array(key).join('  ') + val.title );
        scope.push(val);
      }
    })
  })
}
458915
public synchronized void sendRetry(long retry, EventCallback callback) {

        if (open == 0 || shutdown) {
            if (callback != null) {
                callback.failed(this, null, null, null, new ClosedChannelException());
            }
            return;
        }
        queue.add(new SSEData(retry, callback));
        sink.getIoThread().execute(new Runnable() {
            @Override
            public void run() {
                synchronized (ServerSentEventConnection.this) {
                    if (pooled == null) {
                        fillBuffer();
                        writeListener.handleEvent(sink);
                    }
                }
            }
        });
    }
58868
def before_sleep_log(logger, log_level):
    """"""
    def log_it(retry_state):
        if retry_state.outcome.failed:
            verb, value = 'raised', retry_state.outcome.exception()
        else:
            verb, value = 'returned', retry_state.outcome.result()

        logger.log(log_level,
                   "Retrying %s in %s seconds as it %s %s.",
                   _utils.get_callback_name(retry_state.fn),
                   getattr(retry_state.next_action, 'sleep'),
                   verb, value)
    return log_it