From 37bf287df17aa5ff60d3a1a01e0edae8a1068ea1 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Tue, 11 Sep 2018 04:32:46 -0400 Subject: [PATCH 1/2] Added func to write line to both GUI and CLI logs --- .../com/rarchives/ripme/ui/MainWindow.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 91b53e59..cba017e9 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -1053,6 +1053,12 @@ public final class MainWindow implements Runnable, RipStatusHandler { } } + /** + * Write a line to the Log section of the GUI + * + * @param text the string to log + * @param color the color of the line + */ private void appendLog(final String text, final Color color) { SimpleAttributeSet sas = new SimpleAttributeSet(); StyleConstants.setForeground(sas, color); @@ -1066,6 +1072,17 @@ public final class MainWindow implements Runnable, RipStatusHandler { logText.setCaretPosition(sd.getLength()); } + /** + * Write a line to the GUI log and the CLI log + * + * @param line the string to log + * @param color the color of the line for the GUI log + */ + public void dobuleLog(String line, Color color) { + appendLog(line, color); + LOGGER.error(line); + } + private void loadHistory() { File historyFile = new File(Utils.getConfigDir() + File.separator + "history.json"); HISTORY.clear(); @@ -1213,7 +1230,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { urlText = "http://" + urlText; } URL url = new URL(urlText); - // Ripper is needed here to throw.not throw an Exception + // Ripper is needed here to throw/not throw an Exception AbstractRipper ripper = AbstractRipper.getRipper(url); return true; } catch (Exception e) { @@ -1238,8 +1255,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { queueListModel.add(queueListModel.size(), realURL); ripTextfield.setText(""); } else { - appendLog("Can't find ripper for " + realURL, Color.RED); - LOGGER.error("Can't find ripper for " + realURL); + dobuleLog("Can't find ripper for " + realURL, Color.RED); } } } From 839857426c5313fb5784ed3743f2a16f773d96c8 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Tue, 11 Sep 2018 04:52:25 -0400 Subject: [PATCH 2/2] Changed name of func dobuleLog to displayAndLogError --- src/main/java/com/rarchives/ripme/ui/MainWindow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index cba017e9..e4417c54 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -1078,7 +1078,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { * @param line the string to log * @param color the color of the line for the GUI log */ - public void dobuleLog(String line, Color color) { + public void displayAndLogError(String line, Color color) { appendLog(line, color); LOGGER.error(line); } @@ -1255,7 +1255,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { queueListModel.add(queueListModel.size(), realURL); ripTextfield.setText(""); } else { - dobuleLog("Can't find ripper for " + realURL, Color.RED); + displayAndLogError("Can't find ripper for " + realURL, Color.RED); } } }