Ejemplo n.º 1
0
 /**
  * Log a message to the output handlers.
  * 
  * \param $level
  *   The message log level. This should be one of the ANEWT_LOG_LEVEL_*
  *   constants.
  *
  * \param $message
  *   The message itself. sprintf-style placeholders can be specified.
  *
  * \param $args
  *   An array with data (optional). These values will be substituted for the
  *   placeholders in $message.
  */
 private static function _log($level, $message, $args = null)
 {
     if (!AnewtLog::_is_initialized()) {
         AnewtLog::init();
     }
     global $anewt_logging_handlers;
     if (is_null($args)) {
         $args = array();
     }
     assert('is_int($level) && ($level >= 0) && ($level <= 5)');
     assert('is_string($message)');
     assert('is_array($args)');
     /* Get the variable arguments list */
     while (count($args) == 1 && is_array($args[0])) {
         $args = $args[0];
     }
     if ($args) {
         $message = vsprintf($message, $args);
     }
     $domain = AnewtLog::get_domain();
     foreach ($anewt_logging_handlers as $handler) {
         if ($handler->level >= $level) {
             $handler->log($domain, $level, $message);
         }
     }
 }