@param State  $state
@param Logger $logger

@throws RuntimeException
@throws MarkupException
760470
public function run(State $state, Logger $logger)
    {
        $filesystem = new Filesystem();

        $from = realpath($state->config->getExportDir());
        if (!$from) {
            throw new MarkupException('export dir does not exist');
        }

        if (!$this->destination) {
            throw new MarkupException('destination no set');
        }

        $to = $state->config->getBaseDir() . '/' . $this->destination;

        if ($this->purge) {
            $filesystem->purge($to);
        }

        $logger->log(0, sprintf('mirror export dir (%s -> %s)', $from, $to));

        $filesystem->copy($from, $to);
    }
595083
protected function addToLog($state, $return = NULL)
    {
        $data['name'] = $state;

        if (NULL !== $return) {
            $data['return'] = $return;
        }
        $this->log[] = $data;
    }
1327702
protected void setState(State state) {
        if (DEBUG)
            LOG.debug("{} --> {}", _state, state);
        _state = state;
    }
107718
public static function log($msg, $logLevel = X_LOG_DEBUG) {
        /** @var Logger $logger */
        $logger = ComponentFactory::getComponent('logger');
        $logger->log($msg, $logLevel, 2);
    }
1298756
public function process( BootstrapState $state ) {
		$this->declare_loggers();
		$runner = new RunnerInstance();
		$runner()->init_logger();

		return $state;
	}
267224
public function setLogger(LoggerInterface $logger):void{
		$this->logger = $logger;
		$this->driver->setLogger($logger);
		$this->query->setLogger($logger);
	}
277540
public function setLogger($logger)
    {
        if ($this->logger !== null && ($this->logger instanceof LoggerInterface) === false) {
            throw new Exception\InvalidArgumentException('$logger must be an instance of \Psr\Log\LoggerInterface or null');
        }

        $this->logger = $logger;
        $this->onConfigChanged();
    }
410682
protected function validateScenarioStateOrThrowException(
        Expectation $expectation,
        LoggerInterface $logger
    ) {
        if ($expectation->getNewScenarioState() && !$expectation->getScenarioStateIs()) {
            $logger->error('Scenario states misconfiguration');
            throw new \RuntimeException(
                'Trying to set scenario state without specifying scenario previous state'
            );
        }
    }
1101161
public function register(string $key, LoggerInterface $logger)
    {
        $this->loggers[$key] = $logger;
        $logger->writeHeader();
    }
893405
public static function register(LoggerInterface $logger = null)
    {
        $handler = new static($logger);

        set_error_handler(array($handler, 'handleError'));
        register_shutdown_function(array($handler, 'handleFatalError'));

        set_exception_handler(array($handler, 'handleException'));
    }
312051
public function addLogger($loggerName, $logger)
    {
        if ($logger instanceof LoggerInterface) {
            self::$loggers[$loggerName] = $logger;
        } elseif ($this->debug) {
            throw new InvalidServiceException('Logger Service must implement'.__NAMESPACE__.'LoggerInterface');
        }
    }
619747
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

        if ($this->serviceStream instanceof LoggerAwareInterface) {
            $this->serviceStream->setLogger($this->getLogger());
        }

        if ($this->workerHandlerStream instanceof LoggerAwareInterface) {
            $this->workerHandlerStream->setLogger($this->getLogger());
        }

        return $this;
    }
782867
public function setLogger( LoggerInterface $logger ) {
		$this->logger = $logger;
		$this->session->setLogger( $logger );
	}
104312
public function getAgents(LoggerInterface $logger = null)
    {
        /** @var \GuzzleHttp\Psr7\Response $response */
        $response = $this->loader->load();

        /** @var \FileLoader\Psr7\Stream $stream */
        $stream = $response->getBody();

        $stream->read(1);
        $stream->rewind();

        $regex = (new Regex())->getRegex();

        while (!$stream->eof()) {
            $line = $stream->read(8192);

            if (empty($line)) {
                continue;
            }

            $lineMatches = [];

            if (!preg_match($regex, $line, $lineMatches)) {
                $logger->warning('no useragent found in line "' . $line . '"');
                continue;
            }

            if (isset($lineMatches['userAgentString'])) {
                $agentOfLine = trim($lineMatches['userAgentString']);
            } else {
                $agentOfLine = trim($this->extractAgent($line));
            }

            if (!is_string($agentOfLine)) {
                continue;
            }

            yield $agentOfLine;
        }
    }
648367
protected function checkState(string $state = null):void{

		if(empty($state) || !$this->storage->hasCSRFState($this->serviceName)){
			throw new ProviderException('invalid state for '.$this->serviceName);
		}

		$knownState = $this->storage->getCSRFState($this->serviceName);

		if(!hash_equals($knownState, $state)){
			throw new ProviderException('invalid CSRF state: '.$this->serviceName.' '.$state);
		}

	}
14259
protected function processVariant(
        LoggerInterface $logger,
        SolrIndex $indexInstance,
        $state,
        $class,
        $includeSubclasses,
        $batchSize,
        $taskName
    ) {
        // Set state
        SearchVariant::activate_state($state);

        // Count records
        $query = $class::get();
        if (!$includeSubclasses) {
            $query = $query->filter('ClassName', $class);
        }
        $total = $query->count();

        // Skip this variant if nothing to process, or if there are no records
        if ($total == 0 || $indexInstance->variantStateExcluded($state)) {
            // Remove all records in the current state, since there are no groups to process
            $logger->info("Clearing all records of type {$class} in the current state: " . json_encode($state));
            $this->clearRecords($indexInstance, $class);
            return;
        }

        // For each group, run processing
        $groups = (int)(($total + $batchSize - 1) / $batchSize);
        for ($group = 0; $group < $groups; $group++) {
            $this->processGroup($logger, $indexInstance, $state, $class, $groups, $group, $taskName);
        }
    }
905774
public function call(FuncContext $func, State $state)
    {
        if (!isset($this->functions[$func->name])) {
            throw new MarkupException(sprintf('unknown function %s()', $func->name));
        }

        $callable = $this->functions[$func->name];
        if (!is_callable($callable)) {
            throw new MarkupException(sprintf('function %s() is not callable', $func->name));
        }

        $params = $this->resolveParams($callable, $func, $state);

        if ($callable instanceof MarkupFunction) {
            $callable->setState($state);
        }

        return call_user_func_array($callable, $params);
    }