From 79018fb4e04552b850203e630c6e09e0620a3360 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 6 Aug 2019 12:15:05 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=94=8A=20Fix=20logging=20in=20downloader?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java index ba1c632..55c8167 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java @@ -183,7 +183,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade * @return The parsed Sone, or {@code null} if the Sone could not be parsed */ private Sone parseSone(Sone originalSone, FetchResult fetchResult, FreenetURI requestUri) { - logger.log(Level.FINEST, String.format("Parsing FetchResult (%d bytes, %s) for %s…", fetchResult.size(), fetchResult.getMimeType(), originalSone)); + logger.finest(() -> format("Parsing FetchResult (%d bytes, %s) for %s…", fetchResult.size(), fetchResult.getMimeType(), originalSone)); Bucket soneBucket = fetchResult.asBucket(); InputStream soneInputStream = null; try { @@ -191,12 +191,12 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade Sone parsedSone = soneParser.parseSone(originalSone, soneInputStream); if (parsedSone != null) { - logger.log(Level.FINER, "Sone %s was successfully parsed.", parsedSone); + logger.finer(() -> format("Sone %s was successfully parsed.", parsedSone)); parsedSone.setLatestEdition(requestUri.getEdition()); } return parsedSone; } catch (Exception e1) { - logger.log(Level.WARNING, String.format("Could not parse Sone from %s!", requestUri), e1); + logger.log(Level.WARNING, e1, () -> format("Could not parse Sone from %s!", requestUri)); } finally { close(soneInputStream); close(soneBucket); -- 2.7.4