Get or create a logger

@return LoggerInterface
172092
public function getLogger(OutputInterface $output)
    {
        if ($this->logger === null) {
            $this->logger = new ConsoleLogger($output);
        }
        return $this->logger;
    }
1313070
public function getLogger()
    {
        $logger = app('log');

        // Laravel < 5.6
        if ($logger instanceof \Illuminate\Log\Writer) {
            return $logger->getMonolog();
        }

        // Laravel >= 5.6
        return $logger->getLogger();
    }
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];
    }
180249
protected function getLoggerCallable()
    {
        if (!is_callable($this->loggerCallable)) {
            $loggerCallable = $this->getOption('logger_callable');

            if (is_callable($loggerCallable)) {
                $this->loggerCallable = $loggerCallable;
            }
        }

        return $this->loggerCallable;
    }
354583
public static function getLogger($loggerType, $loggerParams = array()) {
        //trap all possible exceptions and throw LoggerException
        try {
            switch ($loggerType) {
                case LOGGER_STDERR:
                    return self::_getLoggerStderr();
                case LOGGER_LEVEL1:
                    return self::_getLoggerLevel1($loggerParams);
                case LOGGER_LEVEL2:
                    return self::_getLoggerLevel2($loggerParams);                
                case LOGGER_LEVEL3:
                    return self::_getLoggerLevel3($loggerParams);              
                case LOGGER_SECURITY:
                    return self::_getLoggerSecurity($loggerParams);
            }            
        } catch (\Exception $logException) {
            throw new LoggerException('Logger caught an exception in '
                . $logException->getTraceAsString() . ':'
                . $logException->getMessage(), 1001);
        }
    }
112697
public function getLogger()
    {
        if ($this->logger instanceof LoggerInterface) {
            return $this->logger;
        }
        if ($this instanceof ServiceLocatorAwareInterface) {
            $logger = $this->getServiceLocator()->get(LoggerService::SERVICE_ID);
        } else {
            $logger = ServiceManager::getServiceManager()->get(LoggerService::SERVICE_ID);
        }
        return ($logger instanceof LoggerInterface) ? $logger : new NullLogger();
    }
1153528
protected function createEmergencyLogger()
    {
        return new Logger(new Monolog('laravel', $this->prepareHandlers([new StreamHandler(
                $this->app->storagePath().'/logs/laravel.log', $this->level(['level' => 'debug'])
        )])), $this->app['events']);
    }
413236
public function addLogger(LoggerInterface $logger)
    {
        if ($this->isLoggerLoaded() && !($this->logger instanceof NullLogger)) {
            $logger = new LoggerAggregator([$logger, $this->logger]);
        }
        $this->logger = $logger;
        return $logger;
    }
660941
public static function getLogger()
    {
        $logger = null;
        try {
            $logger = Injector::inst()->get('SilverStripe\Omnipay\Logger');
        } catch (NotFoundExceptionInterface $e) {
            /* no op */
        }
        return $logger;
    }
667322
def get_logger(name='', log_stream=None, log_file=None,
               quiet=False, verbose=False):
    """"""

    # configure root logger
    log_level = logging.INFO
    if quiet:
        log_level = logging.WARNING
    elif verbose:
        log_level = logging.DEBUG

    if log_stream is None:
        log_stream = sys.stdout

    new_logger = configure_logger(name, log_stream=log_stream,
                                  log_file=log_file, log_level=log_level)

    return new_logger
1006689
public function getLogger()
    {
        if ($this->logger === null) {
            if ($this->configuration->get('silent')) {
                $this->logger = new Logger\NullLogger();
            } else {
                $loggerClass = $this->configuration->get('logger') ?: '\\Pinocchio\\Logger\\StandardLogger';
                $loggerOpts  = $this->configuration->get('logger_opts') ?: array();

                $this->logger = new $loggerClass($loggerOpts);
            }
        }

        return $this->logger;
    }
266455
public function getLogger() {
		if ($this->_logger !== null) {
			return $this->_logger;
		}
		
		$factoryFirst = $this->isTryLoggersFactoryFirst();
		
		if ($factoryFirst) {
			try {
				$logger = $this->_createLogger();
			} catch (Exception $exception) {}
		}
		
		if (empty($logger)) {
			try {
				$logger = $this->_getLogger();
			} catch (Exception $exception) {}
		}
		
		if (! $factoryFirst && empty($logger)) {
			try {
				$logger = $this->_createLogger();
			} catch (Exception $exception) {}
		}
		
		if (empty($logger)) {
			throw new NoLogger('Unable to provide a logger', 0, $exception);
		}
		
		if (! $logger instanceof LoggerInterface) {
			throw new NoLogger('Logger must implement the "LoggerInterface"');
		}
				
		$this->_logger = $logger;
		return $logger;
	}
536794
protected function getLogger()
    {
        if ($this->container->has('logger')) {
            $logger = $this->container->get('logger');
            \assert($logger instanceof LoggerInterface);

            return $logger;
        }

        return new NullLogger();
    }
284580
protected function getLogger()
    {
        if (!isset($this->loggerClasses[$this->type])) {
            throw new OutOfBoundsException($this->translate(
                'Logger type "{type}" does not exist.',
                ['type' => $this->type]
            ));
        }

        $prototype = $this->getPrototype($this->loggerClasses[$this->type], ['umi\log\ILogger']);

        return $prototype->createSingleInstance(
            [$this->options],
            [],
            function(ILogger $logger)
            {
                $logger
                    ->setMinLevel($this->minLevel)
                    ->setMessageFormat($this->messageFormat);
            }
        );
    }
884730
public function getLogger() {
	    if ($this->logger) {
	        return $this->logger;
	    }
		$this->setLogger(CoreLib\getLogger());
		return $this->logger;
	}
527788
public function getLogger($name = 'defaultLogger')
    {
        if (!isset($this->loggers[$name])) {
            $this->loggers[$name] = $this->buildLogger($name);
        }

        return $this->loggers[$name];
    }
154758
def get_logger(name="peyotl"):
    
    logger = logging.getLogger(name)
    if len(logger.handlers) == 0:
        log_init_warnings = []
        lc = _read_logging_config(log_init_warnings)
        logger.setLevel(lc['level'])
        if lc['filepath'] is not None:
            log_dir = lc['log_dir']
            if log_dir and not os.path.exists(log_dir):
                os.makedirs(log_dir)
            ch = logging.FileHandler(lc['filepath'])
        else:
            ch = logging.StreamHandler()
        ch.setLevel(lc['level'])
        ch.setFormatter(lc['formatter'])
        logger.addHandler(ch)
        if log_init_warnings:
            for w in log_init_warnings:
                logger.warn(w)
    return logger