Restructured project, windows now appear in the center instead of the top

This commit is contained in:
2023-10-02 18:42:01 +03:00
parent 63da644de3
commit d99f604ced
23 changed files with 94 additions and 29 deletions

View File

@@ -1,13 +1,13 @@
package org.lumijiez.managers;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LogManager {
public class LogManager implements Serializable {
private transient BufferedWriter writer;
@@ -20,7 +20,7 @@ public class LogManager {
FileWriter fwriter = new FileWriter(fileHandle);
writerTemp = new BufferedWriter(fwriter);
} catch (IOException e) {
System.err.println("Error!");
e.printStackTrace();
writerTemp = null;
}
this.writer = writerTemp;
@@ -29,14 +29,13 @@ public class LogManager {
public void logOperation(String msg) {
if (writer == null) init();
LocalDateTime currentDateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss |");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss | ");
try {
writer.write(currentDateTime.format(formatter) + msg);
writer.flush();
System.out.println(msg);
writer.newLine();
} catch (IOException e) {
System.err.println("Error!");
e.printStackTrace();
}
}
@@ -46,6 +45,5 @@ public class LogManager {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}