removed boolean for std out console, objectified
This commit is contained in:
parent
b37a16bb89
commit
d3a094b83d
@ -20,7 +20,6 @@ import sarsoo.fmframework.config.VariableEvent;
|
|||||||
import sarsoo.fmframework.config.VariableListener;
|
import sarsoo.fmframework.config.VariableListener;
|
||||||
import sarsoo.fmframework.file.ListPersister;
|
import sarsoo.fmframework.file.ListPersister;
|
||||||
import sarsoo.fmframework.fm.FmAuthNetwork;
|
import sarsoo.fmframework.fm.FmAuthNetwork;
|
||||||
import sarsoo.fmframework.fm.FmNetwork;
|
|
||||||
import sarsoo.fmframework.fx.TextAreaConsole;
|
import sarsoo.fmframework.fx.TextAreaConsole;
|
||||||
import sarsoo.fmframework.fx.service.GetLastTrackService;
|
import sarsoo.fmframework.fx.service.GetLastTrackService;
|
||||||
import sarsoo.fmframework.fx.service.GetScrobbleCountService;
|
import sarsoo.fmframework.fx.service.GetScrobbleCountService;
|
||||||
@ -55,7 +54,7 @@ public class RootController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
Logger.setLog(new Log(TextAreaConsole.getInstance(), false));
|
Logger.setLog(new Log(TextAreaConsole.getInstance()));
|
||||||
|
|
||||||
Config config = FmFramework.getSessionConfig();
|
Config config = FmFramework.getSessionConfig();
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import sarsoo.fmframework.log.console.Console;
|
import sarsoo.fmframework.log.console.Console;
|
||||||
|
import sarsoo.fmframework.log.console.STDOutConsole;
|
||||||
import sarsoo.fmframework.log.entry.ErrorEntry;
|
import sarsoo.fmframework.log.entry.ErrorEntry;
|
||||||
import sarsoo.fmframework.log.entry.InfoEntry;
|
import sarsoo.fmframework.log.entry.InfoEntry;
|
||||||
import sarsoo.fmframework.log.entry.LogEntry;
|
import sarsoo.fmframework.log.entry.LogEntry;
|
||||||
@ -14,8 +15,6 @@ public class Log {
|
|||||||
|
|
||||||
private ArrayList<Console> consoles = new ArrayList<Console>();
|
private ArrayList<Console> consoles = new ArrayList<Console>();
|
||||||
|
|
||||||
private Boolean writeToSTDOut;
|
|
||||||
|
|
||||||
private ArrayList<LogEntry> logList = new ArrayList<LogEntry>();
|
private ArrayList<LogEntry> logList = new ArrayList<LogEntry>();
|
||||||
private ArrayList<InfoEntry> infoList = new ArrayList<InfoEntry>();
|
private ArrayList<InfoEntry> infoList = new ArrayList<InfoEntry>();
|
||||||
private ArrayList<ErrorEntry> errorList = new ArrayList<ErrorEntry>();
|
private ArrayList<ErrorEntry> errorList = new ArrayList<ErrorEntry>();
|
||||||
@ -23,20 +22,19 @@ public class Log {
|
|||||||
private LocalDateTime createdTime = LocalDateTime.now();
|
private LocalDateTime createdTime = LocalDateTime.now();
|
||||||
|
|
||||||
public Log() {
|
public Log() {
|
||||||
writeToSTDOut = true;
|
consoles.add(new STDOutConsole());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Log(Console console, Boolean toSTD) {
|
public Log(Console... consoles) {
|
||||||
|
|
||||||
consoles.add(console);
|
for(Console console: consoles) {
|
||||||
|
this.consoles.add(console);
|
||||||
writeToSTDOut = toSTD;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearConsoles() {
|
public void clearConsoles() {
|
||||||
consoles.clear();
|
consoles.clear();
|
||||||
writeToSTDOut = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(LogEntry entry) {
|
public void log(LogEntry entry) {
|
||||||
@ -64,10 +62,6 @@ public class Log {
|
|||||||
i.write(logString);
|
i.write(logString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeToSTDOut == true) {
|
|
||||||
System.out.println(logString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dumpLog() {
|
public void dumpLog() {
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package sarsoo.fmframework.log.console;
|
||||||
|
|
||||||
|
public class STDOutConsole implements Console {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(String string) {
|
||||||
|
System.out.println(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user