Skip to content

Commit

Permalink
#39 log time
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 11, 2024
1 parent 0e36815 commit 62f9cb2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/eolang/hone/BuildMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.eolang.hone;

import com.jcabi.log.Logger;
import java.io.IOException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
Expand Down Expand Up @@ -66,6 +65,5 @@ public void exec() throws IOException {
temp.path().toString()
);
}
Logger.info(this, "Docker image '%s' was built", this.image);
}
}
7 changes: 7 additions & 0 deletions src/main/java/org/eolang/hone/Docker.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.eolang.hone;

import com.jcabi.log.Logger;
import com.jcabi.log.VerboseProcess;
import java.io.IOException;
import java.util.Arrays;
Expand Down Expand Up @@ -79,9 +80,15 @@ public void exec(final Collection<String> args) throws IOException {
}
command.add("docker");
command.addAll(args);
final long start = System.currentTimeMillis();
final ProcessBuilder bldr = new ProcessBuilder(command);
try (VerboseProcess proc = new VerboseProcess(bldr, Level.FINE, Level.FINE)) {
final VerboseProcess.Result ret = proc.waitFor();
Logger.info(
this, "+ %s -> %d in %[msec]s",
String.join(" ", command), ret.code(),
System.currentTimeMillis() - start
);
if (ret.code() != 0) {
throw new IOException(
String.format("Failed to optimize, code=%d", ret.code())
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/eolang/hone/Mktemp.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ public void close() throws IOException {
.forEach(File::delete);
}
}

}

0 comments on commit 62f9cb2

Please sign in to comment.