mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
- Added 1.7.10 Buildcraft support
- Exceptions can now log to the minetweaker log, for easier bug resolution - /mt hand now copies to the clipboard too - /mt hand now outputs ore dictionary entries to which it belongs - Reducing verbosity a bit
This commit is contained in:
1 parent
86a3568e9e
commit
a8aae17d8a
29 files changed
+1289
-24
No files matched your search
@@ -11,6 +11,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import minetweaker.runtime.ILogger;
|
||||
@@ -21,14 +22,16 @@ import minetweaker.runtime.ILogger;
|
||||
*/
|
||||
public class FileLogger implements ILogger {
|
||||
private final Writer writer;
|
||||
private final PrintWriter printWriter;
|
||||
|
||||
public FileLogger(File output) {
|
||||
try {
|
||||
writer = new OutputStreamWriter(new FileOutputStream(output), "utf-8");
|
||||
printWriter = new PrintWriter(writer);
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
throw new RuntimeException("What the heck?");
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw new RuntimeException("File not found");
|
||||
throw new RuntimeException("Could not open log file " + output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +67,16 @@ public class FileLogger implements ILogger {
|
||||
|
||||
@Override
|
||||
public void logError(String message) {
|
||||
logError(message, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(String message, Throwable exception) {
|
||||
try {
|
||||
writer.write("ERROR: " + message + "\n");
|
||||
if (exception != null) {
|
||||
exception.printStackTrace(printWriter);
|
||||
}
|
||||
writer.flush();
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
||||
Reference in new issue
Block a user