use of com.simiacryptus.util.io.HtmlNotebookOutput in project MindsEye by SimiaCryptus.
the class NotebookReportBase method getLog.
/**
* Gets log.
*
* @param logPath the log path
* @return the log
*/
@Nonnull
public NotebookOutput getLog(CharSequence... logPath) {
try {
if (useMarkdown) {
return MarkdownNotebookOutput.get(getTargetClass(), absoluteUrl, logPath);
} else {
@Nonnull final CharSequence directoryName = new SimpleDateFormat("YYYY-MM-dd-HH-mm").format(new Date());
@Nonnull final File path = new File(Util.mkString(File.separator, "www", directoryName));
path.mkdirs();
@Nonnull final File logFile = new File(path, "index.html");
@Nonnull final HtmlNotebookOutput log;
if (preferStatic) {
log = new HtmlNotebookOutput(path, new FileOutputStream(logFile));
Desktop.getDesktop().browse(logFile.toURI());
} else {
@Nonnull final StreamNanoHTTPD server = new StreamNanoHTTPD(1999, "text/html", logFile).init();
log = new HtmlNotebookOutput(path, server.dataReciever);
}
return log;
}
} catch (@Nonnull final IOException e) {
throw new RuntimeException(e);
}
}
use of com.simiacryptus.util.io.HtmlNotebookOutput in project MindsEye by SimiaCryptus.
the class ImageDecompositionLab method report.
/**
* Gets log.
*
* @return the log
*/
@Nonnull
public HtmlNotebookOutput report() {
try {
@Nonnull final CharSequence directoryName = new SimpleDateFormat("YYYY-MM-dd-HH-mm").format(new Date());
@Nonnull final File path = new File(Util.mkString(File.separator, "www", directoryName));
path.mkdirs();
@Nonnull final File logFile = new File(path, "index.html");
@Nonnull final StreamNanoHTTPD server = new StreamNanoHTTPD(1999, "text/html", logFile).init();
@Nonnull final HtmlNotebookOutput log = new HtmlNotebookOutput(path, server.dataReciever);
return log;
} catch (@Nonnull final IOException e) {
throw new RuntimeException(e);
}
}
Aggregations