diff --git a/build.gradle b/build.gradle index 4398f62..90981ed 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ repositories { dependencies { api 'com.github.Osiris-Team:Easy-Java-Events:1.9.0' - api 'com.github.Osiris-Team:jlib:18.2' + api 'com.github.Osiris-Team:jlib:18.3' api 'com.github.Webview:webview_java:1.3.0' api 'org.nanohttpd:nanohttpd:2.3.1' api 'org.nanohttpd:nanohttpd-websocket:2.3.1' @@ -37,7 +37,7 @@ test { } group = 'com.osiris.desku' -version = '1.0.0' +version = '1.0.1' description = 'Desku' sourceCompatibility = 1.11 targetCompatibility = 1.11 diff --git a/src/main/java/com/osiris/desku/App.java b/src/main/java/com/osiris/desku/App.java index 34b8457..7bfe8ba 100644 --- a/src/main/java/com/osiris/desku/App.java +++ b/src/main/java/com/osiris/desku/App.java @@ -78,7 +78,26 @@ public class App { public static UIManager uis = null; public static ExecutorService executor = Executors.newCachedThreadPool(); + public static class LoggerParams{ + public String name = "Logger"; + public boolean debug = true; + public File logsDir = new File(workingDir+"/logs"); + public File latestLogFile = new File(logsDir + "/latest.log"); + public File mirrorOutFile = new File(logsDir + "/mirror-out.log"); + public File mirrorErrFile = new File(logsDir + "/mirror-err.log"); + public boolean ansi = true; + public boolean forceAnsi = false; + + public LoggerParams() { + logsDir.mkdirs(); + } + } + public static void init(UIManager uiManager) { + init(uiManager, new LoggerParams()); + } + + public static void init(UIManager uiManager, LoggerParams loggerParams) { if (uiManager == null) { throw new NullPointerException("Provided UI factory is null!" + " Make sure to provide an implementation for the platform this app is running in."); @@ -87,8 +106,8 @@ public static void init(UIManager uiManager) { try { Logger.getGlobal().setLevel(Level.SEVERE); if (!AL.isStarted) { - AL.start("Logger", true, new File(workingDir + "/latest.log"), false); - AL.mirrorSystemStreams(new File(workingDir + "/mirror-out.log"), new File(workingDir + "/mirror-err.log")); + AL.start(loggerParams.name, loggerParams.debug, loggerParams.latestLogFile, loggerParams.ansi, loggerParams.forceAnsi); + AL.mirrorSystemStreams(loggerParams.mirrorOutFile, loggerParams.mirrorErrFile); } AL.info("Starting application..."); AL.info("workingDir = " + workingDir);