aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GTLog.java
blob: d9365bbea9d593802ad8e0c4a72011865c358cad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package gregtech.api.util;

import java.io.File;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

/**
 * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
 * <p/>
 * Just a simple Logging Function. If on Server, then this will point to System.out and System.err
 */
public class GTLog {

    public static PrintStream out = System.out;
    public static PrintStream err = System.err;
    public static PrintStream ore = new LogBuffer();
    public static PrintStream exp = new LogBuffer();
    public static File mLogFile;
    public static File mOreDictLogFile;
    public static File mExplosionLog;

    public static class LogBuffer extends PrintStream {

        public final List<String> mBufferedOreDictLog = new ArrayList<>();

        public LogBuffer() {
            super(new OutputStream() {

                @Override
                public void write(int arg0) {
                    /* Do nothing */
                }
            });
        }

        @Override
        public void println(String aString) {
            mBufferedOreDictLog.add(aString);
        }
    }
}