1 package pcc.chemicraft;
3 import java.io.BufferedOutputStream;
4 import java.io.BufferedWriter;
6 import java.io.FileNotFoundException;
7 import java.io.FileOutputStream;
8 import java.io.FileWriter;
9 import java.io.IOException;
11 public class ChemiCraftLogging {
13 private FileWriter outStream;
14 private String directoryPath;
17 public ChemiCraftLogging(String directoryPath) {
18 this.directoryPath = directoryPath;
21 public void startLogging() {
22 this.file = new File(this.directoryPath + "/ChemiCraft.log");
23 if (!this.file.exists()) {
25 this.file.createNewFile();
26 } catch (IOException e) {
32 this.outStream = new FileWriter(this.file);
33 } catch (FileNotFoundException e) {
35 } catch (IOException e) {
40 public void write(String writeStr) {
43 this.outStream.write(writeStr);
44 } catch (IOException e) {
49 public void write(String writeStr, EnumLoggingType type) {
64 throw new IllegalStateException();
67 this.outStream.write(s + "\n");
68 this.outStream.flush();
69 } catch (IOException e) {