我想同时使用Python跟踪多个文件,并将日志发送给Scribe到相应的bucket
我用的是桶:
dict(Config.items('files')).keys()
我使用以下方法获取文件:
^{pr2}$我想同时跟踪所有文件,然后将日志推送到特定的存储桶中:
log_entry = scribe.LogEntry(category, message)
socket = TSocket.TSocket(host='localhost', port=1463)
transport = TTransport.TFramedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(trans=transport, strictRead=False, strictWrite=False)
client = scribe.Client(iprot=protocol, oprot=protocol)
transport.open()
result = client.Log(messages=[log_entry])
transport.close()
这是davidbeazley关于Python生成器的一次非常好的讨论,他有一些非常相关的示例,包括tail:http://www.slideshare.net/dabeaz/python-generator-hacking/82的示例实现
相关问题 更多 >
编程相关推荐