Internal filtering method for determining whether a log line belongs to a specific logger.

@param string $logger
@param array  $line

@return bool
348975
private static function logLineHasLogger($logger, $line)
    {
        if ($logger === null) {
            return true;
        }

        return array_key_exists('logger', $line) && $line['logger'] == $logger;
    }
615583
public function getAgents(LoggerInterface $logger): iterable
    {
        $regex = (new Regex())->getRegex();

        foreach ($this->files as $file) {
            $this->logger->info('    reading file ' . str_pad($file, 100, ' ', STR_PAD_RIGHT));

            $handle = @fopen($file, 'r');

            if (false === $handle) {
                $this->logger->emergency(new \RuntimeException('reading file ' . $file . ' caused an error'));
                continue;
            }

            $i = 1;

            while (!feof($handle)) {
                $line = fgets($handle, 65535);

                if (false === $line) {
                    continue;
                }
                ++$i;

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

                $lineMatches = [];

                if (!preg_match($regex, $line, $lineMatches)) {
                    $logger->error('no useragent found in line "' . $line . '" used regex: "' . $regex . '"');

                    continue;
                }

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

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

                yield $agentOfLine;
            }

            fclose($handle);
        }
    }
949869
public function setLogger(LoggerInterface $logger)
    {
        parent::setLogger($logger);
        foreach ($this->plugins as $plugin) {
            if (!($plugin instanceof LoggerAwareInterface)) {
                continue;
            }

            $plugin->setLogger($logger);
        }
    }
1160672
private boolean isExcludedLogger(String loggerName) {
        for (Pattern excludedLoggerPattern : EXCLUDED_LOGGER_PATTERNS) {
            if (excludedLoggerPattern.matcher(loggerName).matches()) {
                return true;
            }
        }
        return false;
    }
531082
public function removeLogger(IDS_Log_Interface $logger) 
    {
        $key = array_search($logger, $this->loggers);

        if (isset($this->loggers[$key])) {
            unset($this->loggers[$key]);
            return true;
        }

        return false;
    }
613251
private static function logLineHasText($keyword, $line, $searchMeta = true)
    {
        if ($keyword === null) {
            return true;
        }
        if (array_key_exists('message', $line) && strpos(strtolower($line['message']), strtolower($keyword)) !== false) {
            return true;
        }
        if (array_key_exists('date', $line) && strpos(strtolower($line['date']), strtolower($keyword)) !== false) {
            return true;
        }
        if ($searchMeta) {
            if (array_key_exists('context', $line)) {
                $context = $line['context'];
                if (array_key_exists(strtolower($keyword), $context)) {
                    return true;
                }
                foreach ($context as $content) {
                    if (strpos(strtolower($content), strtolower($keyword)) !== false) {
                        return true;
                    }
                }
            }
            if (array_key_exists('extra', $line)) {
                $extra = $line['extra'];
                if (array_key_exists($keyword, $extra)) {
                    return true;
                }
                foreach ($extra as $content) {
                    if (strpos(strtolower($content), strtolower($keyword)) !== false) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
161365
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        $this->extractor->setLogger($logger);
        $this->httpClient->setLogger($logger);
    }
84389
public function setLogger($logger = null)
    {
        if (! (is_null($logger)
            || $logger instanceof LoggerInterface)) {
            throw new InvalidArgumentException(
                'Argument to ' . __METHOD__ .
                " must be a valid Logger Interface (aka. Monolog), " .
                get_class($logger) . ' given.'
            );
        }

        $this->logger = $logger;
    }
330748
public function loggerOnly($loggerOnly = null)
    {
        if (func_num_args() == 0) {
            return $this->loggerOnly;
        }

        $this->loggerOnly = (bool) $loggerOnly;
    }
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;
    }
428074
private void isparentlogger(Logger logchannel) {

        // get all log channels
        List<Logger> referenz = getLoggers();
        Iterator<Logger> it_logger = referenz.iterator();
        while (it_logger.hasNext()) {
            Logger child_test = it_logger.next();
            // if the logchannel has the given logchannel as parent his loglevel is set to the parent one.
            if (logchannel.getName().equals(child_test.getParent().getName())) {
                isparentlogger(child_test);
                child_test.setLevel(null);
            }
        }
    }
953170
private String getLogFiles(Logger logger) {

        String test = "";
        int count = 0;
        // select the Appender from logger
        for (Appender appender : logger.getAppenders().values()) {
            // only use file appenders
            if (CmsLogFileApp.isFileAppender(appender)) {
                String fileName = CmsLogFileApp.getFileName(appender);
                String temp = "";
                temp = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
                test = test + temp;
                count++;
                break;
            }
        }

        //iterate all parent loggers until a logger with appender was found
        while (!logger.equals(LogManager.getRootLogger())) {

            logger = logger.getParent();
            // if no Appender found from logger, select the Appender from parent logger
            if (count == 0) {
                for (Appender appender : logger.getAppenders().values()) {
                    // only use file appenders
                    if (CmsLogFileApp.isFileAppender(appender)) {
                        String fileName = CmsLogFileApp.getFileName(appender);
                        String temp = "";
                        temp = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
                        test = test + temp;
                        count++;
                        break;
                    }
                }
            }
        }

        return test;
    }
2166
public boolean isLoggable(Logger logger, Level l) {
        return logger.isLoggable(l) && l.intValue() >= this.logLevel;
    }
818096
private function initialize_logger( Logger $logger ) {

		$default_handler = $this->use_default_handler( $logger );
		$default_handler and $logger = $logger->pushHandler( $default_handler );

		$default_processor = $this->use_default_processor( $logger );
		$default_processor and $logger = $logger->pushProcessor( $default_processor );

		/**
		 * Fires right before a logger is used for the first time.
		 *
		 * Hook here to set up the logger (e.g., add handlers or processors).
		 *
		 * @param Logger             $logger
		 * @param HandlersRegistry   $handlers_registry
		 * @param ProcessorsRegistry $processors_registry
		 */
		do_action( self::ACTION_LOGGER, $logger, $this->handlers_registry, $this->processors_registry );

		return $logger;
	}
623645
public function clearLog($logKey = null)
    {
        $ret=true;
        if ($logKey==null) {
            foreach ($this->_logFiles as $key => $logFile) {
                $ret = $ret && $this->write("", $logFile);
            }
            return $ret;
        } else {
            $arrayKey=strtolower($logKey);
            if (isset($this->_logFiles[$arrayKey])) {
                return $this->write("", $this->_logFiles[$arrayKey]);
            } else {
                return 0;
            }
        }
    }
82954
protected function _log($textLine, $logPath=null)
    {
        // Return back to console also
        $this->_print($textLine);
        
        $logPath = ($logPath) ? $logPath : $this->logPath;

        if ($logPath)
            return file_put_contents($logPath, $this->_formatTextLine($textLine), FILE_APPEND);
        else
            return false;
    }
1094013
protected function getListenClosure(SqlLogger $logger)
    {
        return function ($query, $bindings = null, $time = null) use ($logger) {
            $logger->log($query, $bindings, $time);
        };
    }