Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
- allow settings logger params
  • Loading branch information
Osiris-Team committed Jun 19, 2024
1 parent 85c168a commit 7929c42
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/com/osiris/desku/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand All @@ -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);
Expand Down

0 comments on commit 7929c42

Please sign in to comment.