use of com.facebook.buck.distributed.thrift.LogRequest in project buck by facebook.
the class ThriftScribeLogger method sendViaThrift.
private void sendViaThrift(String category, Iterable<String> lines) throws IOException {
//Prepare log request.
ScribeData scribeData = new ScribeData();
scribeData.setCategory(category);
copyLinesWithoutNulls(lines, scribeData);
LogRequest logRequest = new LogRequest();
logRequest.setType(LogRequestType.SCRIBE_DATA);
logRequest.setScribeData(scribeData);
// Wrap in high-level request & response.
FrontendRequest request = new FrontendRequest();
request.setType(FrontendRequestType.LOG);
request.setLogRequest(logRequest);
FrontendResponse response = new FrontendResponse();
thriftService.makeRequest(request, response);
if (!response.isWasSuccessful()) {
throw new IOException(String.format("Log request failed. Error from response: %s", response.getErrorMessage()));
}
}
Aggregations