Skip to content

Commit

Permalink
Added a new PrintStream for improving the log
Browse files Browse the repository at this point in the history
  • Loading branch information
JPZV committed Nov 24, 2020
1 parent 4d2d983 commit e97c61c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ml/jordie/vatsimnotify/Bot.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ml.jordie.vatsimnotify;

import ml.jordie.vatsimnotify.logger.LogPrintStream;
import ml.jordie.vatsimnotify.storage.NeoConfigFile;
import ml.jordie.vatsimnotify.vatsim.model.NotifyConfig;
import ml.jordie.vatsimnotify.vatsim.model.GlobalConfig;
Expand Down Expand Up @@ -29,6 +30,8 @@ public class Bot {
* @param args
*/
public static void main(String[] args) {
System.setOut(new LogPrintStream(System.out));
System.setErr(new LogPrintStream(System.err));
new Bot().runBot();
}

Expand Down
17 changes: 17 additions & 0 deletions src/ml/jordie/vatsimnotify/logger/LogPrintStream.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ml.jordie.vatsimnotify.logger;

import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Date;

public class LogPrintStream extends PrintStream {
public LogPrintStream(OutputStream out) {
super(out);
}

@Override
public void println(String string) {
Date date = new Date();
super.println("[" + date.toString() + "] " + string);
}
}

0 comments on commit e97c61c

Please sign in to comment.