From 45b49a43f7e624f471be0b65d3e41a49006aca06 Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Tue, 7 Dec 2021 21:57:05 +0900 Subject: [PATCH 1/1] fix: change log text with using format text. --- src/com/ranfa/lib/AlbumTypeEstimate.java | 2 +- src/com/ranfa/lib/Scraping.java | 4 ++-- src/com/ranfa/main/DelesteRandomSelector.java | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/com/ranfa/lib/AlbumTypeEstimate.java b/src/com/ranfa/lib/AlbumTypeEstimate.java index 9acaa04..698f999 100644 --- a/src/com/ranfa/lib/AlbumTypeEstimate.java +++ b/src/com/ranfa/lib/AlbumTypeEstimate.java @@ -52,7 +52,7 @@ public class AlbumTypeEstimate { } catch (IOException | InterruptedException | ExecutionException e) { e.printStackTrace(); } - logger.info("Album type fetched in " + (System.currentTimeMillis() - time) + "ms"); + logger.info("Album type fetched in {} ms", (System.currentTimeMillis() - time)); return res; } diff --git a/src/com/ranfa/lib/Scraping.java b/src/com/ranfa/lib/Scraping.java index 10343a5..e24082d 100644 --- a/src/com/ranfa/lib/Scraping.java +++ b/src/com/ranfa/lib/Scraping.java @@ -111,7 +111,7 @@ public class Scraping { } catch (IOException | InterruptedException | ExecutionException e) { e.printStackTrace(); } - logger.info("scraping compeleted in " + (System.currentTimeMillis() - time)+ "ms"); + logger.info("scraping compeleted in {} ms", (System.currentTimeMillis() - time)); return res; } @@ -221,7 +221,7 @@ public class Scraping { } else { throw new NullPointerException("json is null."); } - logger.info("JSON reading compeleted in " + (System.currentTimeMillis() - time) + "ms"); + logger.info("JSON reading compeleted in {} ms", (System.currentTimeMillis() - time)); return res; } diff --git a/src/com/ranfa/main/DelesteRandomSelector.java b/src/com/ranfa/main/DelesteRandomSelector.java index 3516dbf..ec8226b 100644 --- a/src/com/ranfa/main/DelesteRandomSelector.java +++ b/src/com/ranfa/main/DelesteRandomSelector.java @@ -126,12 +126,12 @@ public class DelesteRandomSelector extends JFrame { property.setSongLimit(Settings.getSongsLimit()); property.setSaveScoreLog(Settings.saveScoreLog()); logger.debug("Load settings done."); - logger.debug("Version check: " + property.isCheckVersion()); - logger.debug("Library update check: " + property.isCheckLibraryUpdates()); - logger.debug("Window Width: " + property.getWindowWidth()); - logger.debug("Window Height: " + property.getWindowHeight()); - logger.debug("Song Limit: " + property.getSongLimit()); - logger.debug("SaveScoreLog: " + property.isSaveScoreLog()); + logger.debug("Version check: {}", property.isCheckVersion()); + logger.debug("Library update check: {}", property.isCheckLibraryUpdates()); + logger.debug("Window Width: {}", property.getWindowWidth()); + logger.debug("Window Height: {}", property.getWindowHeight()); + logger.debug("Song Limit: {}", property.getSongLimit()); + logger.debug("SaveScoreLog: {}", property.isSaveScoreLog()); EstimateAlbumTypeCycle.Initialization(); if(Files.exists(Paths.get("generated/albumCycle.json"))) { albumType = EstimateAlbumTypeCycle.getCurrentCycle(); @@ -143,10 +143,10 @@ public class DelesteRandomSelector extends JFrame { logger.info("Checking database updates..."); if(list1.size() > list2.size()) { long time = System.currentTimeMillis(); - logger.info((list1.size() - list2.size()) + " Update detected."); + logger.info("{} Update detected.", (list1.size() - list2.size())); Scraping.writeToJson(list1); - logger.info("Update completed in " + (System.currentTimeMillis() - time) + "ms"); - logger.info("Updated database size: " + list1.size()); + logger.info("Update completed in {} ms", (System.currentTimeMillis() - time)); + logger.info("Updated database size: {}", list1.size()); } else { logger.info("database is up-to-date."); } @@ -167,7 +167,7 @@ public class DelesteRandomSelector extends JFrame { CompletableFuture updatedFuture = getWholeDataFuture.thenAcceptBothAsync(getFromJsonFuture, updateConsumer, es); updatedFuture.thenRunAsync(setEnabled, es); } - logger.debug("Version:" + CheckVersion.getVersion()); + logger.debug("Version: {}", CheckVersion.getVersion()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, property.getWindowWidth(), property.getWindowHeight()); // setBounds(100, 100, 640, 360); -- 2.11.0