Skip to content

Commit bdceb88

Browse files
committed
1480: improve logging
1 parent 6efa928 commit bdceb88

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/src/main/java/com/diffplug/spotless/npm/NodeModulesCachingNpmProcessFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public Result waitFor() {
8484
.run(() -> shadowCopy.copyEntryInto(entryName(), NodeServerLayout.NODE_MODULES, nodeServerLayout.nodeModulesDir()));
8585
return new CachedResult();
8686
} else {
87-
Result result = actualNpmInstallProcess.waitFor();
87+
Result result = timedLogger.withInfo("calling actual npm install {}", actualNpmInstallProcess.describe())
88+
.call(actualNpmInstallProcess::waitFor);
8889
assert result.exitCode() == 0;
8990
// TODO: maybe spawn a thread to do this in the background?
9091
timedLogger.withInfo("Caching node_modules for {} in {}", entryName, cacheDir)

lib/src/main/java/com/diffplug/spotless/npm/ShadowCopy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
146146
Files.createLink(target.toPath().resolve(orig.toPath().relativize(file)), file);
147147
return super.visitFile(file, attrs);
148148
} catch (UnsupportedOperationException | SecurityException | FileSystemException e) {
149-
logger.debug("Shadow copy entry does not support hard links: {}", file, e);
149+
logger.info("Shadow copy entry does not support hard links: {}. Switching to copy.", file, e);
150150
tryHardLink = false; // remember that hard links are not supported
151151
} catch (IOException e) {
152-
logger.debug("Shadow copy entry failed to create hard link: {}", file, e);
152+
logger.info("Shadow copy entry failed to create hard link: {}. Switching to copy.", file, e);
153153
tryHardLink = false; // remember that hard links are not supported
154154
}
155155
}

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/JavascriptExtensionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void formattingUsingStyleguide(String styleguide) throws Exception {
178178
" }",
179179
"}");
180180
setFile("test.js").toResource(styleguidePath + "javascript-es6.dirty");
181-
gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
181+
gradleRunner().forwardOutput().withArguments("--info", "--stacktrace", "spotlessApply").build();
182182
assertFile("test.js").sameAsResource(styleguidePath + "javascript-es6.clean");
183183
}
184184
}

0 commit comments

Comments
 (0)