log() public static method

currently only syslog is implemented
public static log ( string $message, integer $level = LOG_INFO )
$message string
$level integer
コード例 #1
0
ファイル: Client.php プロジェクト: s0enke/dropr
 public function __construct(dropr_Client_Storage_Abstract $storage)
 {
     $ipcPath = DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'droprIpc' . DIRECTORY_SEPARATOR;
     $channelName = $ipcPath . hash('sha1', realpath($storage->getDsn()));
     $this->storage = $storage;
     if (!is_dir($ipcPath)) {
         mkdir($ipcPath, 0777, true);
     }
     if (!is_file($channelName)) {
         if (!posix_mknod($channelName, 0666)) {
             throw new Exception("could not mknod {$channelName}!");
         }
     }
     dropr::log("doing ftok({$channelName})", LOG_DEBUG);
     $this->ipcChannel = msg_get_queue(ftok($channelName, '*'));
 }
コード例 #2
0
ファイル: client_queue.php プロジェクト: s0enke/dropr
    if ($queuedMessages = $storage->getQueuedMessages($maxMessagesPerSend, $peerKeyBlackList)) {
        dropr::log("got " . count($queuedMessages, COUNT_RECURSIVE) . " messages from the storage", LOG_DEBUG);
        foreach ($queuedMessages as $peerKey => $peerMessages) {
            /*
             * count the messages regardless they can be sent or not
             */
            $msgCount += count($peerMessages, COUNT_RECURSIVE);
            try {
                $peer = dropr_Client_Peer_Abstract::getInstance($peerKey);
                dropr::log("trying to send messages to peer `" . $peer->getUrl() . "' via method `" . $peer->getTransportMethod() . "'", LOG_DEBUG);
                $result = $peer->send($peerMessages, $storage);
                $storage->checkSentMessages($peerMessages, $result);
                dropr::log("successfully sent messages to the peer!", LOG_DEBUG);
            } catch (Exception $e) {
                $peerKeyBlackList[$peerKey] = time() + $peerTimeout;
                dropr::log("could not sent messages to peer {$peer->getUrl()}- message was: {$e->getMessage()}  - blacklisting the peer for {$peerTimeout} seconds!");
            }
        }
    } else {
        dropr::log("nothing to do. going to sleep.", LOG_DEBUG);
        pcntl_alarm($sleepTimeout);
        @msg_receive($ipcChannel, 1, $msgType, 512, $msg, true, 0, $msgError);
        dropr::log("woke up from sleep - checking for messages ...", LOG_DEBUG);
        pcntl_alarm(0);
    }
}
if ($continue) {
    dropr::log("Restarting after sending {$maxMessagesPerLife} messages into the world.", LOG_INFO);
} else {
    dropr::log("Cleaning up and terminating on request. Goodbye.", LOG_INFO);
}