original_string: public function configureLogger($logger, $level, $logPath = null)
      {
          /** @var Logger $monolog */
          $monolog = $logger;
  
          switch ($level) {
              case 'emergency':
              case 'emerg':
                  $level = Logger::EMERGENCY;
                  break;
              case 'alert':
                  $level = Logger::ALERT;
                  break;
              case 'critical':
              case 'crit':
                  $level = Logger::CRITICAL;
                  break;
              case 'error':
              case 'err':
                  $level = Logger::ERROR;
                  break;
              case 'warning':
              case 'warn':
                  $level = Logger::WARNING;
                  break;
              case 'notice':
                  $level = Logger::NOTICE;
                  break;
              case 'info':
                  $level = Logger::INFO;
                  break;
              case 'debug':
                  $level = Logger::DEBUG;
                  break;
          }
  
          $this['monolog.level']   = $level;
          if ($logPath) {
              $logPath = str_replace(
                  array('{APP_ROOT}', '{DATE}'),
                  array(realpath(__DIR__.'/../..'), $this['kernel.timer.start']),
                  $logPath
              );
              $this['monolog.logfile'] = $logPath;
          }
  
          // remove all handlers from the stack
          try {
              while ($monolog->popHandler()) {
              }
          } catch (\LogicException $e) {
              // popHandler throws an exception when you try to pop the empty stack; to us this is not an
              // error but an indication that the handler stack is empty.
          }
  
          if ($level === 'quiet') {
              $monolog->pushHandler(new NullHandler());
  
              return;
          }
  
          // set our new handlers
          if ($logPath) {
              $monolog->pushHandler(new StreamHandler($logPath, $level));
          } else {
              $monolog->pushHandler(new StreamHandler('php://stdout', $level));
          }
      }
code: public function configureLogger($logger, $level, $logPath = null)
      {
          /** @var Logger $monolog */
          $monolog = $logger;
  
          switch ($level) {
              case 'emergency':
              case 'emerg':
                  $level = Logger::EMERGENCY;
                  break;
              case 'alert':
                  $level = Logger::ALERT;
                  break;
              case 'critical':
              case 'crit':
                  $level = Logger::CRITICAL;
                  break;
              case 'error':
              case 'err':
                  $level = Logger::ERROR;
                  break;
              case 'warning':
              case 'warn':
                  $level = Logger::WARNING;
                  break;
              case 'notice':
                  $level = Logger::NOTICE;
                  break;
              case 'info':
                  $level = Logger::INFO;
                  break;
              case 'debug':
                  $level = Logger::DEBUG;
                  break;
          }
  
          $this['monolog.level']   = $level;
          if ($logPath) {
              $logPath = str_replace(
                  array('{APP_ROOT}', '{DATE}'),
                  array(realpath(__DIR__.'/../..'), $this['kernel.timer.start']),
                  $logPath
              );
              $this['monolog.logfile'] = $logPath;
          }
  
          // remove all handlers from the stack
          try {
              while ($monolog->popHandler()) {
              }
          } catch (\LogicException $e) {
              // popHandler throws an exception when you try to pop the empty stack; to us this is not an
              // error but an indication that the handler stack is empty.
          }
  
          if ($level === 'quiet') {
              $monolog->pushHandler(new NullHandler());
  
              return;
          }
  
          // set our new handlers
          if ($logPath) {
              $monolog->pushHandler(new StreamHandler($logPath, $level));
          } else {
              $monolog->pushHandler(new StreamHandler('php://stdout', $level));
          }
      }
code_tokens: public function configureLogger ( $ logger , $ level , $ logPath = null ) { /** @var Logger $monolog */ $ monolog = $ logger ; switch ( $ level ) { case 'emergency' : case 'emerg' : $ level = Logger :: EMERGENCY ; break ; case 'alert' : $ level = Logger :: ALERT ; break ; case 'critical' : case 'crit' : $ level = Logger :: CRITICAL ; break ; case 'error' : case 'err' : $ level = Logger :: ERROR ; break ; case 'warning' : case 'warn' : $ level = Logger :: WARNING ; break ; case 'notice' : $ level = Logger :: NOTICE ; break ; case 'info' : $ level = Logger :: INFO ; break ; case 'debug' : $ level = Logger :: DEBUG ; break ; } $ this [ 'monolog.level' ] = $ level ; if ( $ logPath ) { $ logPath = str_replace ( array ( '{APP_ROOT}' , '{DATE}' ) , array ( realpath ( __DIR__ . '/../..' ) , $ this [ 'kernel.timer.start' ] ) , $ logPath ) ; $ this [ 'monolog.logfile' ] = $ logPath ; } // remove all handlers from the stack try { while ( $ monolog -> popHandler ( ) ) { } } catch ( \ LogicException $ e ) { // popHandler throws an exception when you try to pop the empty stack; to us this is not an // error but an indication that the handler stack is empty. } if ( $ level === 'quiet' ) { $ monolog -> pushHandler ( new NullHandler ( ) ) ; return ; } // set our new handlers if ( $ logPath ) { $ monolog -> pushHandler ( new StreamHandler ( $ logPath , $ level ) ) ; } else { $ monolog -> pushHandler ( new StreamHandler ( 'php://stdout' , $ level ) ) ; } }
docstring: Removes all logging handlers and replaces them with handlers that can write to the given logPath and level.
  
  @param Logger  $logger       The logger instance that needs to be configured.
  @param integer $level        The minimum level that will be written to the normal logfile; matches one of the
  constants in {@see \Monolog\Logger}.
  @param string  $logPath      The full path where the normal log file needs to be written.
  
  @return void
docstring_tokens: Removes all logging handlers and replaces them with handlers that can write to the given logPath and level .