Ejemplo n.º 1
0
 /**
  * Initiates the module
  *
  * @param \AppserverIo\Server\Interfaces\ServerContextInterface $serverContext The server's context instance
  *
  * @return bool
  * @throws \AppserverIo\Server\Exceptions\ModuleException
  */
 public function init(ServerContextInterface $serverContext)
 {
     // initialize the server context
     $this->serverContext = $serverContext;
     // initialize the profile logger
     if ($serverContext->hasLogger(LoggerUtils::PROFILE)) {
         $this->profileLogger = $serverContext->getLogger(LoggerUtils::PROFILE);
     }
 }
Ejemplo n.º 2
0
 /**
  * Will init the parameter mappings for our hit types
  *
  * @param array $params The parameters to check for requirements
  *
  * @return null
  */
 protected function checkInputParameters(array $params)
 {
     // we only check if we know the requirements
     if (isset($this->requiredParameters[$params['t']])) {
         foreach ($this->requiredParameters[$params['t']] as $requirement) {
             if (!isset($params[$requirement])) {
                 // do the logging, preferably by one of our loggers
                 $message = 'We miss the required parameter "%s", you might not get proper analytics!';
                 if ($this->serverContext->hasLogger(LoggerUtils::SYSTEM)) {
                     $logger = $this->serverContext->getLogger(LoggerUtils::SYSTEM);
                     $logger->warning(sprintf($message, $requirement));
                 } else {
                     error_log(sprintf($message, $requirement));
                 }
             }
         }
     }
 }