Skip to content

Commit 0baae90

Browse files
committed
Prefer slf4j logger
1 parent 31a8553 commit 0baae90

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/org/spongepowered/gradle/vanilla/resolver/jdk/JdkHttpClientDownloader.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
package org.spongepowered.gradle.vanilla.resolver.jdk;
2626

2727
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.slf4j.Logger;
29+
import org.slf4j.LoggerFactory;
2830
import org.spongepowered.gradle.vanilla.internal.resolver.AsyncUtils;
2931
import org.spongepowered.gradle.vanilla.internal.resolver.FileUtils;
3032
import org.spongepowered.gradle.vanilla.resolver.Downloader;
@@ -52,7 +54,7 @@
5254

5355
public class JdkHttpClientDownloader implements Downloader {
5456
public static final long CACHE_TIMEOUT_SECONDS = 24 /* hours */ * 60 /* minutes/hr */ * 60 /* seconds/min */; // todo: replace with ETag
55-
private static final System.Logger LOGGER = System.getLogger(JdkHttpClientDownloader.class.getName());
57+
private static final Logger LOGGER = LoggerFactory.getLogger(JdkHttpClientDownloader.class);
5658

5759
private final Executor asyncExecutor;
5860
private final Path baseDirectory;
@@ -253,15 +255,15 @@ private <T> CompletableFuture<ResolutionResult<T>> downloadValidating(
253255
if (algorithm.validate(expectedHash, path)) {
254256
return existingHandler.apply(path).thenApply(result -> ResolutionResult.result(result, true));
255257
} else {
256-
JdkHttpClientDownloader.LOGGER.log(System.Logger.Level.WARNING, "Found hash mismatch on file at {}, re-downloading", path);
258+
JdkHttpClientDownloader.LOGGER.warn("Found hash mismatch on file at {}, re-downloading", path);
257259
}
258260
} catch (final IOException ex) {
259-
JdkHttpClientDownloader.LOGGER.log(System.Logger.Level.WARNING, "Failed to test hash on file at {}, re-downloading", path);
261+
JdkHttpClientDownloader.LOGGER.warn("Failed to test hash on file at {}, re-downloading", path);
260262
}
261263
try {
262264
Files.deleteIfExists(path);
263265
} catch (final IOException ex) {
264-
JdkHttpClientDownloader.LOGGER.log(System.Logger.Level.WARNING, "Failed to delete file at {}, will try to re-download anyways", path);
266+
JdkHttpClientDownloader.LOGGER.warn("Failed to delete file at {}, will try to re-download anyways", path);
265267
}
266268
}
267269

@@ -317,7 +319,7 @@ static HttpResponse.BodyHandler<Path> downloading(final Path path) {
317319
try {
318320
FileUtils.createDirectoriesSymlinkSafe(path.getParent());
319321
} catch (final IOException ex) {
320-
JdkHttpClientDownloader.LOGGER.log(System.Logger.Level.WARNING, "Failed to create directory {} before downloading", path.getParent(), ex);
322+
JdkHttpClientDownloader.LOGGER.warn("Failed to create directory {} before downloading", path.getParent(), ex);
321323
}
322324
return HttpResponse.BodyHandlers.ofFile(path);
323325
}

0 commit comments

Comments
 (0)