Horde::log PHP Method

log() public static method

Shortcut to logging method.
See also: Horde_Core_Log_Logger
public static log ( $event, $priority = null, array $options = [] )
$options array
    public static function log($event, $priority = null, array $options = array())
    {
        $options['trace'] = isset($options['trace']) ? $options['trace'] + 1 : 1;
        $log_ob = new Horde_Core_Log_Object($event, $priority, $options);
        /* Chicken/egg: we must wait until we have basic framework setup
         * before we can start logging. Otherwise, queue entries. */
        if (isset($GLOBALS['injector']) && Horde_Core_Factory_Logger::available()) {
            $GLOBALS['injector']->getInstance('Horde_Log_Logger')->logObject($log_ob);
        } else {
            Horde_Core_Factory_Logger::queue($log_ob);
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Generate a prefix for the History system for the given Kolab data.
  *
  * @param  Horde_Kolab_Storage_Data $data  The data object.
  *
  * @return string  The History prefix.
  */
 public static function getPrefix(Horde_Kolab_Storage_Data $data)
 {
     $app = self::_type2app($data->getType());
     if (empty($app)) {
         Horde::log(sprintf('Unsupported app type: %s', $data->getType()), 'WARN');
         return false;
     }
     // Determine share id
     $user = $data->getAuth();
     $folder = $data->getPath();
     $share_id = '';
     $all_shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create($app)->listAllShares();
     foreach ($all_shares as $id => $share) {
         if ($folder == $share->get('folder')) {
             $share_id = $id;
             break;
         }
     }
     // Bail out if we are unable to determine the share id.
     if (empty($share_id)) {
         Horde::log(sprintf('HISTORY: share_id not found. Can\'t compute history prefix for user: %s, folder: %s', $user, $folder), 'WARN');
         return false;
     }
     return $app . ':' . $share_id . ':';
 }
All Usage Examples Of Horde::log