@param State  $state
@param Logger $logger

@throws \RuntimeException
15837
public function run(State $state, Logger $logger)
    {
        $codeParser = new CodeParser();

        $cacheDir  = $state->config->getCacheDir();
        $cacheNote = $cacheDir ? 'cache at ' . $cacheDir : 'cache disabled';

        $logger->log(0, sprintf('parse class dirs (%s)', $cacheNote));

        $classes = $codeParser->parse($state->config->getClassDirs(), $state->config->getCacheDir());

        if ($logger->hasDepth(1)) {
            foreach ($classes as $class) {
                $logger->log(1, sprintf('found class <cyan>%s<reset> in %s', $class->name, $class->fileName));
            }
        }

        $state->classes = $classes;
    }
461452
public function addState(StateInterface $state): self
    {
        $builder = clone $this;
        $builder->states[$state->getName()] = $state;
        return $builder;
    }
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;
    }
433704
private function applyDecorators(LoggerInterface $logger, array $config)
    {
        foreach ($this->decorators as $configKey => $decoratorClassName) {
            if (!isset($config[$configKey])) {
                continue;
            }
            if (!class_exists($decoratorClassName)) {
                throw new \RuntimeException('Decorator class not found: ' . $decoratorClassName);
            }
            if (!is_subclass_of($decoratorClassName, '\Phlib\Logger\Decorator\AbstractDecorator')) {
                throw new \RuntimeException('Decorator class invalid: ' . $decoratorClassName);
            }
            /** @var \Phlib\Logger\Decorator\AbstractDecorator $logger */
            $logger = new $decoratorClassName($logger, $config[$configKey]);
        }

        return $logger;
    }
107718
public static function log($msg, $logLevel = X_LOG_DEBUG) {
        /** @var Logger $logger */
        $logger = ComponentFactory::getComponent('logger');
        $logger->log($msg, $logLevel, 2);
    }
1277681
protected function _addState($state)
    {
        if (!is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state.'),
                null,
                null,
                $state
            );
        }

        $this->states[(string) $state] = $state;
    }
90069
protected function addLogEntry(LogEntry $entry)
	{
		// Find all the appropriate loggers based on priority and category for the entry.
		$loggers = $this->findLoggers($entry->priority, $entry->category);

		foreach ((array) $loggers as $signature)
		{
			// Attempt to instantiate the logger object if it doesn't already exist.
			if (empty($this->loggers[$signature]))
			{
				$class = '\\Joomla\\Log\\Logger\\' . ucfirst($this->configurations[$signature]['logger']);

				if (class_exists($class))
				{
					$this->loggers[$signature] = new $class($this->configurations[$signature]);
				}
				else
				{
					throw new \RuntimeException('Unable to create a Joomla\\Log\\AbstractLogger instance: ' . $class);
				}
			}

			// Add the entry to the logger.
			$this->loggers[$signature]->addEntry(clone($entry));
		}
	}
854075
public static function logException (LoggerInterface $logger, Exception $exception)
  {
    $logger->error (sprintf ("%s, at %s(%s)", $exception->getMessage (),
      ErrorConsole::shortFileName ($exception->getFile ()), $exception->getLine ()));
  }
283473
public function setLogger($logger = null)
    {

        if ($logger instanceOf \sb\Logger\Base) {
            $this->logger = $logger;
        } else {
            $this->logger = new \sb\Logger\FileSystem();
        }
    }
71984
public function setLogsDir(string $logsDir): void
    {
        if (!file_exists($logsDir) || !is_writable($logsDir)) {
            throw new LoggerException('Logs path does not exist or is not writable.');
        }
        $this->logsDir = rtrim($logsDir, '/') . '/';
    }
713237
public static final Transaction.Status encode(final TxnState.State state, final String logString) {
        Preconditions.checkNotNull(state, "state");
        Exceptions.checkNotNullOrEmpty(logString, "logString");

        Transaction.Status result;
        switch (state) {
            case COMMITTED:
                result = Transaction.Status.COMMITTED;
                break;
            case ABORTED:
                result = Transaction.Status.ABORTED;
                break;
            case OPEN:
                result = Transaction.Status.OPEN;
                break;
            case ABORTING:
                result = Transaction.Status.ABORTING;
                break;
            case COMMITTING:
                result = Transaction.Status.COMMITTING;
                break;
            case UNKNOWN:
                throw new RuntimeException("Unknown transaction: " + logString);
            case UNRECOGNIZED:
            default:
                throw new IllegalStateException("Unknown status: " + state);
        }
        return result;
    }
868392
public function setState(StateInterface $state): StateManagerInterface
    {
        $this->collection->offsetSet($state->getIdentifier()->getId(), $state);
        
        return $this;
    }
19000
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

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

        return $this;
    }
986745
private function prepareLogsDir($logsDir)
    {
        if (!is_dir($logsDir)) {
            if (false === @mkdir($logsDir, 0777, true) && !is_dir($logsDir)) {
                throw new \RuntimeException(sprintf("Unable to create the logs directory (%s)\n", $logsDir));
            }
        } elseif (!is_writable($logsDir)) {
            throw new \RuntimeException(sprintf("Unable to write in the logs directory (%s)\n", $logsDir));
        }
    }
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();
    }
283942
protected function _setState($state)
    {
        if ($state !== null && !is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state'),
                null,
                null,
                $state
            );
        }

        $this->state = $state;
    }
1333951
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        if (isset($logger)) {
            $this->parser->setLogger($logger);
            $this->nsParser->setLogger($logger);
        }
    }