use of io.fabric8.maven.docker.log.DefaultLogCallback in project docker-maven-plugin by fabric8io.
the class DockerAccessWithHcClient method createExecResponseHandler.
private ResponseHandler<Object> createExecResponseHandler(LogOutputSpec outputSpec) throws FileNotFoundException {
final LogCallback callback = new DefaultLogCallback(outputSpec);
return new ResponseHandler<Object>() {
@Override
public Object handleResponse(HttpResponse response) throws IOException {
try (InputStream stream = response.getEntity().getContent()) {
LineNumberReader reader = new LineNumberReader(new InputStreamReader(stream));
String line;
try {
callback.open();
while ((line = reader.readLine()) != null) {
callback.log(1, new Timestamp(), line);
}
} catch (LogCallback.DoneException e) {
// Ok, we stop here ...
} finally {
callback.close();
}
}
return null;
}
};
}
use of io.fabric8.maven.docker.log.DefaultLogCallback in project docker-maven-plugin by fabric8io.
the class LogDispatcher method trackContainerLog.
public synchronized void trackContainerLog(String containerId, LogOutputSpec spec) {
LogGetHandle handle = dockerAccess.getLogAsync(containerId, new DefaultLogCallback(spec));
logHandles.put(containerId, handle);
}
use of io.fabric8.maven.docker.log.DefaultLogCallback in project docker-maven-plugin by fabric8io.
the class DefaultLogCallbackTest method before.
@Before
public void before() throws IOException {
file = File.createTempFile("logcallback", ".log");
file.deleteOnExit();
spec = new LogOutputSpec.Builder().prefix("callback-test> ").file(file.toString()).build();
callback = new DefaultLogCallback(spec);
callback.open();
ts = new Timestamp("2016-12-21T15:09:00.999666333Z");
}
Aggregations