src/Application.php
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;
  }
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;
  }
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 ; }
Creates and Initializes the Logger

@return self
Creates and Initializes the Logger