Create and return a Logger

@param string $className the class name which is observed by the logger
@return Logger
431114
public static function create($className) {
        // The best logger configuration for the given class name
        $bestLoggerConfiguration = LoggerManager::findBestLoggerConfigurationForClass($className);

        // If no logger configuration was found for the given class name
        if (!isset($bestLoggerConfiguration)) {
            // Return an empty logger
            return new Logger($className);
        }

        // A logger configuration has been found for the given class name
        $logger = new Logger($className);
        $logger->_targetClassName = $bestLoggerConfiguration['class'];
        $logger->_level = LogLevel::createFromCode($bestLoggerConfiguration['level']);
        $logger->_setupWriters($bestLoggerConfiguration['writers']);

        return $logger;
    }
1320788
public static function instantiate($className)
    {
        $objectManager = self::get()->getObjectManager();
        $args = func_get_args();

        if (1 === count($args)) {
            return $objectManager->get($className);
        }

        return call_user_func_array([$objectManager, 'get'], $args);
    }
408999
public function getLogger($name = null)
    {
        $name = is_null($name) ? $this->defaultLogger : $name;
        $name = "{$this->getPrefix()}$name";
        if (!isset(static::$_loggers[$name])) {
            static::$_loggers[$name] = new Logger($name);
            $this->_setDefaultHandlers(static::$_loggers[$name]);
        }
        return static::$_loggers[$name];
    }
1245198
public function create($className, $filePath)
    {
        $compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem);

        $compiler->setClassName($className);
        $compiler->setFilePath($filePath);
        $compiler->setLogger($this->logger);

        return $compiler;
    }
933371
public function logger($name = null)
	{
		$name = $name ?: $this->getDefaultLog();

		// If the given driver has not been created before, we will create the instances
		// here and cache it so we can return it next time very quickly. If there is
		// already a driver created by this name, we'll just return that instance.
		if (! isset($this->loggers[$name]))
		{
			$this->loggers[$name] = $this->createLog($name);
		}

		return $this->loggers[$name];
	}
812694
protected function createLogger(string $loggerName)
  {
    # Create the Logger Object
    $this->logger = new \Nofuzz\Log\Logger($loggerName);

    # Get the conf options
    $logLevel = $this->getConfig()->get('log.level','error');
    $logDriver = $this->getConfig()->get('log.driver','file');

    $logDateFormat = $this->getConfig()->get('log.drivers.'.$logDriver.'.line_datetime','Y-m-d H:i:s');
    $logLineFormat = $this->getConfig()->get('log.drivers.'.$logDriver.'.line_format','%datetime% > %level_name% > %message% %context% %extra%');

    if ( strcasecmp($logDriver,"file")==0 ) {
      $logFilePath = $this->getConfig()->get('log.drivers.'.$logDriver.'.file_path','storage/log');
      $logFileFormat = $this->getConfig()->get('log.drivers.'.$logDriver.'.file_format','Y-m-d');
      # Create the Log Handler
      $handler = new \Monolog\Handler\StreamHandler(
        realpath($this->basePath.'/'.$logFilePath).'/'.date($logFileFormat).'.log',
        $this->getLogger()->toMonologLevel($logLevel)
      );

    } else if ( strcasecmp($logDriver,"php")==0 ) {
      # Create the Log Handler
      $handler = new \Monolog\Handler\ErrorLogHandler (
        \Monolog\Handler\ErrorLogHandler::OPERATING_SYSTEM,
        $this->getLogger()->toMonologLevel($logLevel)
      );

    }
    # finally, create a formatter for it
    $formatter = new \Monolog\Formatter\LineFormatter($logLineFormat, $logDateFormat);
    $handler->setFormatter($formatter);

    # Push the handler to the logger
    $this->logger->pushHandler($handler);

    # Set our own error handlers
    $this->setErrorHandlers();

    return $this;
  }
939552
private function createControllerFromClassName($className)
    {
        // If we can, use the container to build the Controller so that Constructor params can
        // be injected where possible
        if ($this->invoker) {
            return $this->invoker->getContainer()->get($className);
        }

        return new $className;
    }
1187599
public static function instance($className = __CLASS__)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = new $className;
        }

        return self::$instances[$className];
    }
571192
public function getLogger($loggerName)
    {

        try {
            // first let's see if we've an application logger registered
            if ($logger = $this->getApplication()->getLogger($loggerName)) {
                return $logger;
            }

            // then try to load the global logger instance if available
            return $this->getApplication()->getNamingDirectory()->search(sprintf('php:global/log/%s', $loggerName));

        } catch (NamingException $ne) {
            // do nothing, we simply have no logger with the requested name
        }
    }
1226638
public static function create($className, $level) {
        // Create the event
        $event = new LogEvent();

        // Assign level and message
        $event->_setLevel(LogLevel::create($level));

        // Initialize current date and time (with milliseconds)
        $event->_setDate(DateMilli::create());

        // Initialize trace
        $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 4);

        $trace['class'] = $className;
        $trace['file'] = $trace[2]['file'];
        $trace['line'] = $trace[2]['line'];
        $event->_setTrace($trace);

        return $event;
    }
625726
public static function create( $className = null )
    {
        if ( is_null( $className ) )
        {
            $ini = eZINI::instance( 'ezcomments.ini' );
            $className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
        }
        return  new $className();
    }
580792
public static function getInstance($config, $classname = 'IDS_Log_Database')
    {
        if ($config instanceof IDS_Init) {
            $wrapper = $config->config['Logging']['wrapper'];
        } elseif (is_array($config)) {
            $wrapper = $config['wrapper'];
        }

        if (!isset(self::$instances[$wrapper])) {
            self::$instances[$wrapper] = new $classname($config);
        }

        return self::$instances[$wrapper];
    }
81566
public function create(string $className)
    {
        if (array_key_exists($className, $this->cache)) {
            return $this->cache[$className];
        }

        if (!class_exists($className)) {
            throw new RuntimeException("Mapper not found. Attempted to load '{$className}'.");
        }

        $instance = new $className($this->connection, $this->table);
        $this->cache[$className] = $instance;

        return $instance;
    }
67417
private function createLogger()
    {
        if ($this->silent) {
            $logger = new SilentLogger();
            self::$msgOutputLevel = Project::MSG_WARN;
        } elseif ($this->loggerClassname !== null) {
            self::import($this->loggerClassname);
            // get class name part
            $classname = self::import($this->loggerClassname);
            $logger = new $classname();
            if (!($logger instanceof BuildLogger)) {
                throw new BuildException($classname . ' does not implement the BuildLogger interface.');
            }
        } else {
            $logger = new DefaultLogger();
        }
        $logger->setMessageOutputLevel(self::$msgOutputLevel);
        $logger->setOutputStream(self::$out);
        $logger->setErrorStream(self::$err);
        $logger->setEmacsMode($this->emacsMode);

        return $logger;
    }
99453
public function addClass($classname)
    {
        $classArr = $this->getClassArray();
        $classArr[] = $classname;
        return $this->setClassArray($classArr);
    }
1251249
public static function fromClass($className)
    {
        return new self(
            \Pheasant::instance()->schema($className),
            \Pheasant::instance()->finderFor($className)
        );
    }
1002790
public function createLogger($name)
    {
        // short circuit for cached logger objects
        if (true === array_key_exists($name, $this->_logger)) {
            return $this->_logger[$name];
        }

        $loggerConfig  = $this->_getLoggerConfig($name);
        $handlers      = $this->createHandlers($loggerConfig);
        $processors    = $this->createProcessors($loggerConfig);
        $logger        = new Monolog\Logger(
            $name,
            $handlers,
            $processors
        );

        // cache created logger
        $this->_logger[$name] = $logger;

        return $logger;
    }