log() public method

Add a message to the log
public log ( string $message, integer $level = self::NOTICE ) : boolean
$message string The message to log
$level integer The logging level
return boolean Whether the messages was logged
Exemplo n.º 1
0
 /**
  * Invalidate the query cache
  *
  * @return void
  */
 protected function invalidateQueryCache()
 {
     if ($this->queryCache) {
         $this->queryCache->clear();
         $this->logger->log("Query cache invalidated", \Elgg\Logger::INFO);
     }
 }
Exemplo n.º 2
0
 /**
  * Includes view PHP or static file
  * 
  * @param string $view                 The view name
  * @param array  $vars                 Variables passed to view
  * @param string $viewtype             The viewtype
  * @param bool   $issue_missing_notice Log a notice if the view is missing
  *
  * @return string|false output generated by view file inclusion or false
  */
 private function renderViewFile($view, array $vars, $viewtype, $issue_missing_notice)
 {
     $file = $this->findViewFile($view, $viewtype);
     if (!$file) {
         if ($issue_missing_notice) {
             $this->logger->log("{$viewtype}/{$view} view does not exist.", 'NOTICE');
         }
         return false;
     }
     if (pathinfo($file, PATHINFO_EXTENSION) === 'php') {
         ob_start();
         include $file;
         return ob_get_clean();
     }
     return file_get_contents($file);
 }