Accepts another handler function to be used on close().
$until_level defaults to CRITICAL.
4249
public static function init ($handler, $until_level = 2) {
		self::$handler = $handler;

		return function ($info) use ($until_level) {
			LevelBuffer::$buffer .= vsprintf (\Analog\Analog::$format, $info);
			if ($info['level'] <= $until_level) {
				// flush and reset the buffer
				LevelBuffer::flush ();
				LevelBuffer::$buffer = '';
			}
		};
	}
192444
function until(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  let wrapper = function untilHandler(event) {
    if (handler(event))
      emitter.removeEventListener(eventName, untilHandler);
  };
  emitter.addEventListener(eventName, wrapper);
  return wrapper;
}
884329
function _stop_element_handler($parser, $name)
    {
        if (isset($this->current)) {
            $this->current = new BigInteger(base64_decode($this->current), 256);
            unset($this->current);
        }
    }
732304
public function shutdownHandler()
    {
        $error = error_get_last();

        if(!is_null($error)) {
            $this->exceptionHandler(new FatalErrorException($error['message'], $error['type'], 0, $error['file'], $error['line'], 0));
        }
    }
275438
def fatal( callingClass, astr_key, **kwargs ):
    '''
    
    '''
    kwargs['exitToOS']  = True
    report( callingClass, astr_key, **kwargs )
1284160
function listenExit(handler) {
  const onSighup = () => {
    process.exit(1 | 0x80);
  };

  const onSigint = () => {
    process.exit(2 | 0x80);
  };

  const onSigterm = () => {
    process.exit(15 | 0x80);
  };

  const onError = (err) => {
    if (err && err.stack)
      console.error(String(err.stack));
    else
      console.error(String(err));

    process.exit(1);
  };

  process.once('exit', handler);

  if (process.listenerCount('SIGHUP') === 0)
    process.once('SIGHUP', onSighup);

  if (process.listenerCount('SIGINT') === 0)
    process.once('SIGINT', onSigint);

  if (process.listenerCount('SIGTERM') === 0)
    process.once('SIGTERM', onSigterm);

  if (process.listenerCount('uncaughtException') === 0)
    process.once('uncaughtException', onError);

  process.on('newListener', (name) => {
    switch (name) {
      case 'SIGHUP':
        process.removeListener(name, onSighup);
        break;
      case 'SIGINT':
        process.removeListener(name, onSigint);
        break;
      case 'SIGTERM':
        process.removeListener(name, onSigterm);
        break;
      case 'uncaughtException':
        process.removeListener(name, onError);
        break;
    }
  });
}
227055
def CloseHandle(self):
        ''''''
        if hasattr(self, 'handle'):
            ret = vmGuestLib.VMGuestLib_CloseHandle(self.handle.value)
            if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
            del(self.handle)
69385
def until(method, timeout = 30, message=''):
        """"""
        end_time = time.time() + timeout
        while True:
            try:
                value = method()
                if value:
                    return value
            except:
                pass            
            time.sleep(1)
            if time.time() > end_time:
                break
        raise Exception(message)
363290
function rejectHandler(err) {
  process.stderr.write(`${err.stack || err}\n`);

  if (sh.config.fatal) {
    sh.exit(1);
  }

  return Promise.reject(err);
}
728894
def delayed_close(self):
        """"""
        self.state = CLOSING
        self.server.io_loop.add_callback(self.close)
39254
def close(self):
        '''
        '''
        if self.closed: return
        for func,arglist in self.callbacks:
            apply(func, arglist)
        self.closed = True
1072687
function Handler(level) {
	level = level || Logger.NOTSET;

	if (Logger.getLevelName(level) === '') {
		throw new Error('Argument 1 of Handler.constructor has unsupported'
			+ ' value \'' + level + '\'');
	}

	Filterer.call(this);

	/**
	 * @private
	 * @type {number}
	 */
	this._level = level;

	/**
	 * @private
	 * @type {Object}
	 */
	this._formatter = null;
}
163480
function close() {
    if (watcher && !closed) {
      if (options.persistent) {
        // Close handle only if watcher was created persistent.
        watcher.close();
      }
      else {
        // Stop handling change events.
        watcher.removeAllListeners();
        // Leave watcher on error events that may come from unclosed handle.
        watcher.on('error', function (err) { });
      }
      closed = true;
    }
  }
1121714
function fatal_handler()
    {
        $error = error_get_last();
        if ($error !== null && $error['type'] == E_ERROR) {
            $errno   = $error["type"];
            $errfile = $error["file"];
            $errline = $error["line"];
            $errstr  = $error["message"];
            Log::info("Error ($errno) in $errfile on line $errline: $errstr");
            header("HTTP/1.1 500 Internal Server Error");
        }
    }
195845
def close(self):
        
        if self.bOwnership and self.value not in (None, INVALID_HANDLE_VALUE):
            if Handle.__bLeakDetection:     # XXX DEBUG
                print("CLOSE HANDLE (%d) %r" % (self.value, self))
            try:
                self._close()
            finally:
                self._value = None
728303
function _stop_element_handler($parser, $name)
    {
        if (isset($this->current)) {
            $this->current = new Math_BigInteger(base64_decode($this->current), 256);
            unset($this->current);
        }
    }
32115
function handleExit (canCancel, signal, code) {
	var i = 0,
		sub;

	while ((sub = subs[i++])) {
		if (sub[0].call(sub[1], canCancel, signal, code) === false && canCancel) {
			return;
		}
	}

	if (canCancel) {
		process.exit(code);
	}
}