opHandler()
{
if (!$this->handlers) {
throw new \LogicException('You tried to pop from an empty handler stack.');
}
return \array_shift($this->handlers);
}
/**
* Set handlers, replacing all existing ones.
*
* If a map is passed, keys will be ignored.
*
* @param HandlerInterface[] $handlers
* @return $this
*/
public function setHandlers(array $handlers)
{
$this->handlers = array();
foreach (\array_reverse($handlers) as $handler) {
$this->pushHandler($handler);
}
return $this;
}
/**
* @return HandlerInterface[]
*/
public function getHandlers()
{
return $this->handlers;
}
/**
* Adds a processor on to the stack.
*
* @param callable $callback
* @return $this
*/
public function pushProcessor($callback)
{
if (!\is_callable($callback)) {
throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), ' . \var_export($callback, \true) . ' given');
}
\array_unshift($this->processors, $callback);
return $this;
}
/**
* Removes the processor on top of the stack and returns it.
*
* @return callable
*/
public function popProcessor()
{
if (!$this->processors) {
throw new \LogicException('You tried to pop from an empty processor stack.');
}
return \array_shift($this->processors);
}
/**
* @return callable[]
*/
public function getProcessors()
{
return $this->processors;
}
/**
* Control the use of microsecond resolution timestamps in the 'datetime'
* member of new records.
*
* Generating microsecond resolution timestamps by calling
* microtime(true), formatting the result via sprintf() and then parsing
* the resulting string via \DateTime::createFromFormat() can incur
* a measurable runtime overhead vs simple usage of DateTime to capture
* a second resolution timestamp in systems which generate a large number
* of log events.
*
* @param bool $micro True to use microtime() to create timestamps
*/
public function useMicrosecondTimestamps($micro)
{
$this->microsecondTimestamps = (bool) $micro;
}
/**
* Adds a log record.
*
* @param int $level The logging level
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addRecord($level, $message, array $context = array())
{
if (!$this->handlers) {
$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
}
$levelName = static::getLevelName($level);
// check if any handler will handle this message so we can return early and save cycles
$handlerKey = null;
\reset($this->handlers);
while ($handler = \current($this->handlers)) {
if ($handler->isHandling(array('level' => $level))) {
$handlerKey = \key($this->handlers);
break;
}
\next($this->handlers);
}
if (null === $handlerKey) {
return \false;
}
if (!static::$timezone) {
static::$timezone = new \DateTimeZone(\date_default_timezone_get() ?: 'UTC');
}
// php7.1+ always has microseconds enabled, so we do not need this hack
if ($this->microsecondTimestamps && \PHP_VERSION_ID < 70100) {
$ts = \DateTime::createFromFormat('U.u', \sprintf('%.6F', \microtime(\true)), static::$timezone);
} else {
$ts = new \DateTime('now', static::$timezone);
}
$ts->setTimezone(static::$timezone);
$record = array('message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => $levelName, 'channel' => $this->name, 'datetime' => $ts, 'extra' => array());
try {
foreach ($this->processors as $processor) {
$record = \call_user_func($processor, $record);
}
while ($handler = \current($this->handlers)) {
if (\true === $handler->handle($record)) {
break;
}
\next($this->handlers);
}
} catch (Exception $e) {
$this->handleException($e, $record);
}
return \true;
}
/**
* Ends a log cycle and frees all resources used by handlers.
*
* Closing a Handler means flushing all buffers and freeing any open resources/handles.
* Handlers that have been closed should be able to accept log records again and re-open
* themselves on demand, but this may not always be possible depending on implementation.
*
* This is useful at the end of a request and will be called automatically on every handler
* when they get destructed.
*/
public function close()
{
foreach ($this->handlers as $handler) {
if (\method_exists($handler, 'close')) {
$handler->close();
}
}
}
/**
* Ends a log cycle and resets all handlers and processors to their initial state.
*
* Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal
* state, and getting it back to a state in which it can receive log records again.
*
* This is useful in case you want to avoid logs leaking between two requests or jobs when you
* have a long running process like a worker or an application server serving multiple requests
* in one process.
*/
public function reset()
{
foreach ($this->handlers as $handler) {
if ($handler instanceof ResettableInterface) {
$handler->reset();
}
}
foreach ($this->processors as $processor) {
if ($processor instanceof ResettableInterface) {
$processor->reset();
}
}
}
/**
* Adds a log record at the DEBUG level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addDebug($message, array $context = array())
{
return $this->addRecord(static::DEBUG, $message, $context);
}
/**
* Adds a log record at the INFO level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addInfo($message, array $context = array())
{
return $this->addRecord(static::INFO, $message, $context);
}
/**
* Adds a log record at the NOTICE level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addNotice($message, array $context = array())
{
return $this->addRecord(static::NOTICE, $message, $context);
}
/**
* Adds a log record at the WARNING level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addWarning($message, array $context = array())
{
return $this->addRecord(static::WARNING, $message, $context);
}
/**
* Adds a log record at the ERROR level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addError($message, array $context = array())
{
return $this->addRecord(static::ERROR, $message, $context);
}
/**
* Adds a log record at the CRITICAL level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addCritical($message, array $context = array())
{
return $this->addRecord(static::CRITICAL, $message, $context);
}
/**
* Adds a log record at the ALERT level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addAlert($message, array $context = array())
{
return $this->addRecord(static::ALERT, $message, $context);
}
/**
* Adds a log record at the EMERGENCY level.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addEmergency($message, array $context = array())
{
return $this->addRecord(static::EMERGENCY, $message, $context);
}
/**
* Gets all supported logging levels.
*
* @return array Assoc array with human-readable level names => level codes.
*/
public static function getLevels()
{
return \array_flip(static::$levels);
}
/**
* Gets the name of the logging level.
*
* @param int $level
* @return string
*/
public static function getLevelName($level)
{
if (!isset(static::$levels[$level])) {
throw new InvalidArgumentException('Level "' . $level . '" is not defined, use one of: ' . \implode(', ', \array_keys(static::$levels)));
}
return static::$levels[$level];
}
/**
* Converts PSR-3 levels to Monolog ones if necessary
*
* @param string|int $level Level number (monolog) or name (PSR-3)
* @return int
*/
public static function toMonologLevel($level)
{
if (\is_string($level)) {
// Contains chars of all log levels and avoids using strtoupper() which may have
// strange results depending on locale (for example, "i" will become "İ")
$upper = \strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
if (\defined(__CLASS__ . '::' . $upper)) {
return \constant(__CLASS__ . '::' . $upper);
}
}
return $level;
}
/**
* Checks whether the Logger has a handler that listens on the given level
*
* @param int $level
* @return bool
*/
public function isHandling($level)
{
$record = array('level' => $level);
foreach ($this->handlers as $handler) {
if ($handler->isHandling($record)) {
return \true;
}
}
return \false;
}
/**
* Set a custom exception handler
*
* @param callable $callback
* @return $this
*/
public function setExceptionHandler($callback)
{
if (!\is_callable($callback)) {
throw new \InvalidArgumentException('Exception handler must be valid callable (callback or object with an __invoke method), ' . \var_export($callback, \true) . ' given');
}
$this->exceptionHandler = $callback;
return $this;
}
/**
* @return callable
*/
public function getExceptionHandler()
{
return $this->exceptionHandler;
}
/**
* Delegates exception management to the custom exception handler,
* or throws the exception if no custom handler is set.
*/
protected function handleException(Exception $e, array $record)
{
if (!$this->exceptionHandler) {
throw $e;
}
\call_user_func($this->exceptionHandler, $e, $record);
}
/**
* Adds a log record at an arbitrary level.
*
* This method allows for compatibility with common interfaces.
*
* @param mixed $level The log level
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function log($level, $message, array $context = array())
{
$level = static::toMonologLevel($level);
return $this->addRecord($level, $message, $context);
}
/**
* Adds a log record at the DEBUG level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function debug($message, array $context = array())
{
return $this->addRecord(static::DEBUG, $message, $context);
}
/**
* Adds a log record at the INFO level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function info($message, array $context = array())
{
return $this->addRecord(static::INFO, $message, $context);
}
/**
* Adds a log record at the NOTICE level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function notice($message, array $context = array())
{
return $this->addRecord(static::NOTICE, $message, $context);
}
/**
* Adds a log record at the WARNING level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function warn($message, array $context = array())
{
return $this->addRecord(static::WARNING, $message, $context);
}
/**
* Adds a log record at the WARNING level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function warning($message, array $context = array())
{
return $this->addRecord(static::WARNING, $message, $context);
}
/**
* Adds a log record at the ERROR level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function err($message, array $context = array())
{
return $this->addRecord(static::ERROR, $message, $context);
}
/**
* Adds a log record at the ERROR level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function error($message, array $context = array())
{
return $this->addRecord(static::ERROR, $message, $context);
}
/**
* Adds a log record at the CRITICAL level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function crit($message, array $context = array())
{
return $this->addRecord(static::CRITICAL, $message, $context);
}
/**
* Adds a log record at the CRITICAL level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function critical($message, array $context = array())
{
return $this->addRecord(static::CRITICAL, $message, $context);
}
/**
* Adds a log record at the ALERT level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function alert($message, array $context = array())
{
return $this->addRecord(static::ALERT, $message, $context);
}
/**
* Adds a log record at the EMERGENCY level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function emerg($message, array $context = array())
{
return $this->addRecord(static::EMERGENCY, $message, $context);
}
/**
* Adds a log record at the EMERGENCY level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function emergency($message, array $context = array())
{
return $this->addRecord(static::EMERGENCY, $message, $context);
}
/**
* Set the timezone to be used for the timestamp of log records.
*
* This is stored globally for all Logger instances
*
* @param \DateTimeZone $tz Timezone object
*/
public static function setTimezone(\DateTimeZone $tz)
{
self::$timezone = $tz;
}
}
Fatal error: Uncaught Error: Class "AIOSEO\Vendor\Monolog\Logger" not found in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Tools/BadBotBlocker.php:215
Stack trace:
#0 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(373): AIOSEO\Plugin\Common\Tools\BadBotBlocker->init()
#1 /home/valigeria/public_html/wp-includes/class-wp-hook.php(324): AIOSEO\Plugin\AIOSEO->loadInit('')
#2 /home/valigeria/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /home/valigeria/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /home/valigeria/public_html/wp-settings.php(695): do_action('init')
#5 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...')
#6 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...')
#7 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...')
#8 /home/valigeria/public_html/index.php(17): require('/home/valigeria...')
#9 {main}
thrown in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Tools/BadBotBlocker.php on line 215