]>
git.proxmox.com Git - ceph.git/blob - ceph/src/blkin/babeltrace-plugins/scribe_client/scribe_client.py
4 from scribe
import scribe
5 from thrift
.transport
import TTransport
, TSocket
6 from thrift
.protocol
import TBinaryProtocol
8 class ScribeClient(object):
10 def __init__(self
, port
, host
):
16 def openConnection(self
):
17 socket
= TSocket
.TSocket(host
=self
.host
, port
=self
.port
)
18 self
.transport
= TTransport
.TFramedTransport(socket
)
19 protocol
= TBinaryProtocol
.TBinaryProtocol(trans
=self
.transport
,
22 self
.client
= scribe
.Client(protocol
)
25 def log(self
, category
, message
):
26 log_entry
= scribe
.LogEntry(category
, message
)
27 result
= self
.client
.Log(messages
=[log_entry
])
28 return result
# 0 for success
31 self
.transport
.close()