Setter for logging.

@param LoggerInterface $logger The logging to attach

@author Benjamin Carl <opensource@clickalicious.de>

@throws Doozr_Logging_Exception

@return null
422159
public function setLogger(LoggerInterface $logger)
    {
        if (!$logger instanceof SplObserver) {
            throw new Doozr_Logging_Exception(
                sprintf('Please implement SplObserver before trying to attach your logging.')
            );
        }

        $this->attach($logger);

        return null;
    }
677643
private function configureLogger(\n2n\log4php\Logger $logger, $config) {
		$loggerName = $logger->getName();
		
		// Set logger level
		if (isset($config['level'])) {
			$level = \n2n\log4php\LoggerLevel::toLevel($config['level']);
			if (isset($level)) {
				$logger->setLevel($level);
			} else {
				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
			}
		}
		
		// Link appenders to logger
		if (isset($config['appenders'])) {
			foreach($config['appenders'] as $appenderName) {
				if (isset($this->appenders[$appenderName])) {
					$logger->addAppender($this->appenders[$appenderName]);
				} else {
					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
				}
			}
		}
		
		// Set logger additivity
		if (isset($config['additivity'])) {
			try {
				$additivity = \n2n\log4php\option\OptionConverter::toBooleanEx($config['additivity'], null);
				$logger->setAdditivity($additivity);
			} catch (Exception $ex) {
				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
			}
		}
	}
496139
public function setLogger(\sb\Logger\Base $logger, $logname=''){
        $this->logger = $logger;
        $this->log_name = $logname ? $logname : get_called_class();
        $this->log_name = preg_replace("~[^\w+]~", "_", $this->log_name);
    }
949869
public function setLogger(LoggerInterface $logger)
    {
        parent::setLogger($logger);
        foreach ($this->plugins as $plugin) {
            if (!($plugin instanceof LoggerAwareInterface)) {
                continue;
            }

            $plugin->setLogger($logger);
        }
    }
1118220
public function setLogger(LoggerInterface $logger)
	{
		$this->logger = $logger;

		foreach ($this->services as $name) {
			if ($this->$name && $this->$name instanceof \Psr\Log\LoggerAwareInterface) {
				$this->$name->setLogger($logger);
			}
		}

		return $this;
	}
379205
public function setLogger($logger)
    {
        $this->logger = $logger;
        $this->connection->getConfiguration()->setSQLLogger($this->logger);
        return $this;
    }
1333951
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        if (isset($logger)) {
            $this->parser->setLogger($logger);
            $this->nsParser->setLogger($logger);
        }
    }
701819
public static function setup(LoggerInterface $logger, int $verbosity = 1): void
    {
        self::$logger = $logger;
        self::setVerbosity($verbosity);
    }
463770
public function setLogDir($logDir)
    {
        $logDir = trim($logDir);
        if (!file_exists($logDir) || !is_writable($logDir)) {
            throw new \InvalidArgumentException("Invalid log directory!");
        }

        $this->_logDir = $logDir;
    }
1362377
public function setLogger(\Psc\System\Logger $logger, $prefix = NULL) {
    $this->logger = $logger;
    $this->logger->setPrefix($prefix ?: '['.Code::getClassName($this).']');
    return $this;
  }
413594
protected function setLogger()
    {
        $settings = $this->module->getSettings('dev');

        $this->logger->printError(!empty($settings['print_error']))
            ->errorToException(!empty($settings['error_to_exception']))
            ->printBacktrace(!empty($settings['print_error_backtrace']));
    }
211071
private static function createOnBlockHandler(LoggerInterface $logger): callable
    {
        return static function(int $blockInterval) use ($logger): void
        {
            $trace     = \debug_backtrace();
            $traceData = ['info' => []];

            /** skip first since it's always the current method */
            \array_shift($trace);
            /** the call_user_func call is also skipped */
            \array_shift($trace);

            $i = 0;

            while (isset($trace[$i]['class']))
            {
                /** @noinspection SlowArrayOperationsInLoopInspection */
                $traceData['info'] = \array_merge(
                    $traceData['info'],
                    [
                        'file'     => $trace[$i - 1]['file'] ?? null,
                        'line'     => $trace[$i - 1]['line'] ?? null,
                        'class'    => $trace[$i]['class'] ?? null,
                        'function' => $trace[$i]['function'] ?? null,
                    ]
                );

                $i++;
            }

            $traceData['lockTime'] = 0 !== $blockInterval ? $blockInterval / 1000 : 0;

            $logger->error('A lock event loop has been detected. Blocking time: {lockTime} seconds', $traceData);

            unset($traceData, $trace, $i);
        };
    }
927602
private function logMessage(
        LoggerInterface $logger,
        string $level,
        string $value
    ) {
        /**
         * Logs content, using specified level.
         */
        $logger->$level($value);
    }
19000
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

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

        return $this;
    }
1348968
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        $this->factory->setLogger($logger);
        return $this;
    }
348975
private static function logLineHasLogger($logger, $line)
    {
        if ($logger === null) {
            return true;
        }

        return array_key_exists('logger', $line) && $line['logger'] == $logger;
    }
674684
public final function setLogger( ?LoggerInterface $logger )
   {

      $this->_options[ 'logger' ] = null === $logger ? new NullLogger() : $logger;

      unset( $this->_options[ 'data' ] );

      return $this;

   }