1: <?php
2: 3: 4: 5:
6:
7: 8: 9: 10:
11: class Horde_Scribe_Client implements Horde_Scribe
12: {
13: 14: 15:
16: private $_transport;
17:
18: 19: 20:
21: private $_client;
22:
23: public function connect($host = 'localhost', $port = 1463)
24: {
25: $socket = new TSocket($host, $port, true);
26: $this->_transport = new TFramedTransport($socket);
27: $protocol = new TBinaryProtocol($this->_transport, false, false);
28: $this->_client = new scribeClient($protocol, $protocol);
29: }
30:
31: public function log($category, $message)
32: {
33: $this->logMulti(array($this->makeEntry($category, $message)));
34: }
35:
36: public function logMulti(array $messages)
37: {
38: $this->_transport->open();
39: $this->_client->Log($messages);
40: $this->_transport->close();
41: }
42:
43: public function makeEntry($category, $message)
44: {
45: return new LogEntry(array('category' => $category, 'message' => $message));
46: }
47: }
48: