当前位置: 首页>>代码示例>>PHP>>正文


PHP ZLog类代码示例

本文整理汇总了PHP中ZLog的典型用法代码示例。如果您正苦于以下问题:PHP ZLog类的具体用法?PHP ZLog怎么用?PHP ZLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ZLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Handle

 /**
  * Handles the GetAttachment command
  *
  * @param int       $commandCode
  *
  * @access public
  * @return boolean
  */
 public function Handle($commandCode)
 {
     $attname = Request::GetGETAttachmentName();
     if (!$attname) {
         return false;
     }
     try {
         $attachment = self::$backend->GetAttachmentData($attname);
         $stream = $attachment->data;
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment stream from backend: %s", $stream));
         header("Content-Type: application/octet-stream");
         $l = 0;
         while (!feof($stream)) {
             $d = fgets($stream, 4096);
             $l += strlen($d);
             echo $d;
             // announce an update every 100K
             if ($l / 1024 % 100 == 0) {
                 self::$topCollector->AnnounceInformation(sprintf("Streaming attachment: %d KB sent", round($l / 1024)));
             }
         }
         fclose($stream);
         self::$topCollector->AnnounceInformation(sprintf("Streamed %d KB attachment", $l / 1024), true);
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment with %d KB sent to mobile", $l / 1024));
     } catch (StatusException $s) {
         // StatusException already logged so we just need to pass it upwards to send a HTTP error
         throw new HTTPReturnCodeException($s->getMessage(), HTTP_CODE_500, null, LOGLEVEL_DEBUG);
     }
     return true;
 }
开发者ID:karanikn,项目名称:php-addressbook,代码行数:38,代码来源:getattachment.php

示例2: OXreq

 public function OXreq($requestOBJ, $returnResponseObject)
 {
     $requestOBJ->setCookieJar($this->cookiejar);
     $requestOBJ->setHeader('User-Agent: z-push-ox (Version ' . BackendOX::getBackendVersion() . ')');
     $response = $requestOBJ->send();
     $this->cookiejar = $requestOBJ->getCookieJar();
     if ($returnResponseObject) {
         return $response;
     }
     if (200 != $response->getStatus()) {
         ZLog::Write(LOGLEVEL_WARN, 'BackendOX::OXreq(error: ' . $response->getBody() . ')');
         return false;
     }
     try {
         $data = json_decode($response->getBody(), true);
         if (is_array($data) && array_key_exists("error", $data)) {
             ZLog::Write(LOGLEVEL_WARN, 'BackendOX::OXreq(error: ' . $response->getBody() . ')');
             return false;
         } else {
             return $data;
         }
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:aniesshsethh,项目名称:z-push-ox,代码行数:25,代码来源:OXConnector.php

示例3: zarafa_error_handler

function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
    $bt = debug_backtrace();
    switch ($errno) {
        case 8192:
            // E_DEPRECATED since PHP 5.3.0
            // do not handle this message
            break;
        case E_NOTICE:
        case E_WARNING:
            // TODO check if there is a better way to avoid these messages
            if (stripos($errfile, 'interprocessdata') !== false && stripos($errstr, 'shm_get_var()') !== false) {
                break;
            }
            ZLog::Write(LOGLEVEL_WARN, "{$errfile}:{$errline} {$errstr} ({$errno})");
            break;
        default:
            ZLog::Write(LOGLEVEL_ERROR, "trace error: {$errfile}:{$errline} {$errstr} ({$errno}) - backtrace: " . (count($bt) - 1) . " steps");
            for ($i = 1, $bt_length = count($bt); $i < $bt_length; $i++) {
                $file = $line = "unknown";
                if (isset($bt[$i]['file'])) {
                    $file = $bt[$i]['file'];
                }
                if (isset($bt[$i]['line'])) {
                    $line = $bt[$i]['line'];
                }
                ZLog::Write(LOGLEVEL_ERROR, "trace: {$i}:" . $file . ":" . $line . " - " . (isset($bt[$i]['class']) ? $bt[$i]['class'] . $bt[$i]['type'] : "") . $bt[$i]['function'] . "()");
            }
            //throw new Exception("An error occured.");
            break;
    }
}
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:32,代码来源:zpush-utils.php

示例4: Handle

 /**
  * Handles a webservice command
  *
  * @param int       $commandCode
  *
  * @access public
  * @return boolean
  * @throws SoapFault
  */
 public function Handle($commandCode)
 {
     if (Request::GetDeviceType() !== "webservice" || Request::GetDeviceID() !== "webservice") {
         throw new FatalException("Invalid device id and type for webservice execution");
     }
     if (Request::GetGETUser() != Request::GetAuthUser()) {
         ZLog::Write(LOGLEVEL_INFO, sprintf("Webservice::HandleWebservice('%s'): user '%s' executing action for user '%s'", $commandCode, Request::GetAuthUser(), Request::GetGETUser()));
     }
     // initialize non-wsdl soap server
     $this->server = new SoapServer(null, array('uri' => "http://z-push.sf.net/webservice"));
     // the webservice command is handled by its class
     if ($commandCode == ZPush::COMMAND_WEBSERVICE_DEVICE) {
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("Webservice::HandleWebservice('%s'): executing WebserviceDevice service", $commandCode));
         include_once 'webservicedevice.php';
         $this->server->setClass("WebserviceDevice");
     }
     // the webservice command is handled by its class
     if ($commandCode == ZPush::COMMAND_WEBSERVICE_USERS) {
         if (!defined("ALLOW_WEBSERVICE_USERS_ACCESS") || ALLOW_WEBSERVICE_USERS_ACCESS !== true) {
             throw new HTTPReturnCodeException(sprintf("Access to the WebserviceUsers service is disabled in configuration. Enable setting ALLOW_WEBSERVICE_USERS_ACCESS.", Request::GetAuthUser()), 403);
         }
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("Webservice::HandleWebservice('%s'): executing WebserviceUsers service", $commandCode));
         if (ZPush::GetBackend()->Setup("SYSTEM", true) == false) {
             throw new AuthenticationRequiredException(sprintf("User '%s' has no admin privileges", Request::GetAuthUser()));
         }
         include_once 'webserviceusers.php';
         $this->server->setClass("WebserviceUsers");
     }
     $this->server->handle();
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("Webservice::HandleWebservice('%s'): sucessfully sent %d bytes", $commandCode, ob_get_length()));
     return true;
 }
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:41,代码来源:webservice.php

示例5: DoForcePingTimeout

 /**
  * Checks if there are newer ping requests for the same device & user so
  * the current process could be terminated
  *
  * @access public
  * @return boolean true if the current process is obsolete
  */
 public function DoForcePingTimeout()
 {
     while (true) {
         self::$redis->watch($this->key);
         $savedtime = self::$redis->get($this->key);
         if ($savedtime === false || $savedtime < $_SERVER['REQUEST_TIME']) {
             $res = self::$redis->multi()->setex($this->key, self::TTL, $_SERVER['REQUEST_TIME'])->exec();
             if ($res === false) {
                 ZLog::Write(LOGLEVEL_DEBUG, "DoForcePingTimeout(): set just failed, retrying");
                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("DoForcePingTimeout() key: '%s' reqtime: '%s' last_error: '%s'", $this->key, $_SERVER['REQUEST_TIME'], self::$redis->getLastError()));
                 continue;
             } else {
                 return false;
             }
         }
         // Don't compare types, only values
         if ($savedtime == $_SERVER['REQUEST_TIME']) {
             self::$redis->unwatch();
             return false;
         }
         if ($savedtime > $_SERVER['REQUEST_TIME']) {
             self::$redis->unwatch();
             return true;
         }
     }
 }
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:33,代码来源:PingTrackingRedis.php

示例6: Handle

 /**
  * Handles the GetAttachment command
  *
  * @param int       $commandCode
  *
  * @access public
  * @return boolean
  */
 public function Handle($commandCode)
 {
     $attname = Request::GetGETAttachmentName();
     if (!$attname) {
         return false;
     }
     try {
         $attachment = self::$backend->GetAttachmentData($attname);
         $stream = $attachment->data;
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment stream from backend: %s", $stream));
         // need to check for a resource here, as eg. feof('Error') === false and causing infinit loop in while!
         if (!is_resource($stream)) {
             throw new StatusException(sprintf("HandleGetAttachment(): No stream resource returned by backend for attachment: %s", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
         }
         header("Content-Type: application/octet-stream");
         self::$topCollector->AnnounceInformation("Starting attachment streaming", true);
         $l = fpassthru($stream);
         fclose($stream);
         if ($l === false) {
             throw new FatalException("HandleGetAttachment(): fpassthru === false !!!");
         }
         self::$topCollector->AnnounceInformation(sprintf("Streamed %d KB attachment", round($l / 1024)), true);
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment with %d KB sent to mobile", round($l / 1024)));
     } catch (StatusException $s) {
         // StatusException already logged so we just need to pass it upwards to send a HTTP error
         throw new HTTPReturnCodeException($s->getMessage(), HTTP_CODE_500, null, LOGLEVEL_DEBUG);
     }
     return true;
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:37,代码来源:getattachment.php

示例7: ZLog

 /**
  * Get ZLog instance
  * @return ZLog
  */
 public static function &getInstance()
 {
     if (self::$m_instance == null) {
         self::$m_instance = new ZLog();
     }
     return self::$m_instance;
 }
开发者ID:BGCX261,项目名称:zoombi-svn-to-git,代码行数:11,代码来源:log.php

示例8: Block

 /**
  * Blocks the mutex
  * Method blocks until mutex is available!
  * ATTENTION: make sure that you *always* release a blocked mutex!
  *
  * @access public
  * @return boolean
  */
 public function Block()
 {
     if ($this->IsActive()) {
         return $this->blockMutex();
     }
     ZLog::Write(LOGLEVEL_WARN, "Could not enter mutex as InterProcessData is not available. This is not recommended on duty systems and may result in corrupt user/device linking!");
     return true;
 }
开发者ID:karanikn,项目名称:php-addressbook,代码行数:16,代码来源:simplemutex.php

示例9: __construct

 public function __construct($message = "", $code = 0, $previous = NULL, $logLevel = false)
 {
     if (!$message) {
         $message = $this->httpReturnMessage;
     }
     if (!$logLevel) {
         $logLevel = $this->defaultLogLevel;
     }
     parent::__construct($message, (int) $code);
     ZLog::Write($logLevel, get_class($this) . ': ' . $message . ' - code: ' . $code . ' - file: ' . $this->getFile() . ':' . $this->getLine(), false);
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:11,代码来源:zpushexception.php

示例10: onTask

 public function onTask($server, $taskId, $fromId, $data)
 {
     Request::parse($data);
     Request::addParams('taskId', $taskId . '_' . $fromId);
     try {
         ZRoute::route();
     } catch (\Exception $e) {
         $model = Formater::exception($e);
         ZLog::info('exception', $model);
     }
 }
开发者ID:jonny77,项目名称:zmail,代码行数:11,代码来源:Tcp.php

示例11: ZPushException

 public function ZPushException($message = "", $code = 0, $previous = NULL, $logLevel = false)
 {
     if (!$message) {
         $message = $this->httpReturnMessage;
     }
     if (!$logLevel) {
         $logLevel = $this->defaultLogLevel;
     }
     ZLog::Write($logLevel, get_class($this) . ': ' . $message . ' - code: ' . $code);
     parent::__construct($message, (int) $code);
 }
开发者ID:karanikn,项目名称:php-addressbook,代码行数:11,代码来源:zpushexception.php

示例12: ZPushException

 public function ZPushException($message = "", $code = 0, $previous = NULL, $logLevel = false)
 {
     if (!$message) {
         $message = $this->httpReturnMessage;
     }
     if (!$logLevel) {
         $logLevel = $this->defaultLogLevel;
     }
     ZLog::Write($logLevel, sprintf("%s: %s - code: %s - file: %s:%s", get_class($this), $message, $code, $this->getFile(), $this->getLine()), false);
     parent::__construct($message, (int) $code);
 }
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:11,代码来源:zpushexception.php

示例13: Check

 /**
  * Method checks if the object has the minimum of required parameters
  * and fullfills semantic dependencies
  *
  * This overloads the general check() with special checks to be executed
  *
  * @param boolean   $logAsDebug     (opt) default is false, so messages are logged in WARN log level
  *
  * @access public
  * @return boolean
  */
 public function Check($logAsDebug = false)
 {
     $ret = parent::Check($logAsDebug);
     if (!$ret) {
         return false;
     }
     if (isset($this->start) && isset($this->until) && $this->until < $this->start) {
         ZLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter 'start' is HIGHER than 'until'. Check failed!", get_class($this)));
         return false;
     }
     return true;
 }
开发者ID:netconstructor,项目名称:sogosync,代码行数:23,代码来源:synctaskrecurrence.php

示例14: stream_open

 /**
  * Opens the stream
  * The string to be streamed is passed over the context
  *
  * @param string    $path           Specifies the URL that was passed to the original function
  * @param string    $mode           The mode used to open the file, as detailed for fopen()
  * @param int       $options        Holds additional flags set by the streams API
  * @param string    $opened_path    If the path is opened successfully, and STREAM_USE_PATH is set in options,
  *                                  opened_path should be set to the full path of the file/resource that was actually opened.
  *
  * @access public
  * @return boolean
  */
 public function stream_open($path, $mode, $options, &$opened_path)
 {
     $contextOptions = stream_context_get_options($this->context);
     if (!isset($contextOptions[self::PROTOCOL]['string'])) {
         return false;
     }
     $this->position = 0;
     // this is our stream!
     $this->stringstream = $contextOptions[self::PROTOCOL]['string'];
     $this->stringlength = strlen($this->stringstream);
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("StringStreamWrapper::stream_open(): initialized stream length: %d", $this->stringlength));
     return true;
 }
开发者ID:netconstructor,项目名称:sogosync,代码行数:26,代码来源:stringstreamwrapper.php

示例15: Open

 /**
  * Instantiates a stream
  *
  * @param string $string  The string to be wrapped
  * @access public
  * @return stream
  */
 public static function Open($string)
 {
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("StringStreamWrapper::Open(): len = %d", strlen($string)));
     if (defined('BUG68532FIXED') && BUG68532FIXED === true) {
         ZLog::Write(LOGLEVEL_DEBUG, "StringStreamWrapper::Open(): Using php://temp");
         $stream = fopen('php://temp', 'r+');
     } else {
         ZLog::Write(LOGLEVEL_DEBUG, "StringStreamWrapper::Open(): Using tmpfile()");
         $stream = tmpfile();
     }
     fwrite($stream, $string);
     rewind($stream);
     return $stream;
 }
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:21,代码来源:stringstreamwrapper.php


注:本文中的ZLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。