Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 17, 2024
1 parent 147b41b commit 6e96149
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ public final class PullMojo extends SafeMojo {
private boolean overWrite;

@Override
@SuppressWarnings("PMD.PrematureDeclaration")
public void exec() throws IOException {
if (this.offline) {
Logger.info(
this,
"No programs were pulled because eo.offline flag is TRUE"
);
} else {
final long start = System.currentTimeMillis();
if (this.hash == null) {
this.hash = new ChCached(
new ChNarrow(
Expand All @@ -137,7 +139,8 @@ public void exec() throws IOException {
} catch (final IOException exception) {
throw new IOException(
String.format(
"Failed to pull object discovered at %s",
"Failed to pull object '%s' discovered at %s",
tojo.identifier(),
tojo.discoveredAt()
),
exception
Expand All @@ -147,8 +150,9 @@ public void exec() throws IOException {
}
Logger.info(
this,
"%d program(s) were pulled: %s",
"%d program(s) were pulled in %[ms]s: %s",
tojos.size(),
System.currentTimeMillis() - start,
names
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void showsWhereNotFoundWasDiscoveredAt(@Mktmp final Path tmp, final Logs out)
);
Assertions.assertTrue(
out.captured().stream().anyMatch(
line -> line.contains("Failed to pull object discovered at")
line -> line.contains("Failed to pull object 'org.eolang.org' discovered at")
),
"Log should contain info where failed to pull object was discovered at, but it does not"
);
Expand Down

0 comments on commit 6e96149

Please sign in to comment.