package Zyun.Lam.Game.MonsterQuest;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Zyun
 */

//This is just a basic one... Will 
public class SystemLog {
    private static String log = "No Problem";
    static FileWriter logFileOutput = null;
    static BufferedWriter logFileWriter = null;

    
    
    public static void log (String text) {
        //Create Time Stamp
        Date timeStamp = new Date();
        String content = ("[" + timeStamp + "] " + text);
        try {
            logFileOutput = new FileWriter("system.log", true);
            logFileWriter = new BufferedWriter(logFileOutput);
            logFileWriter.write(content);
            logFileWriter.newLine();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (logFileWriter != null)
                    logFileWriter.close();
                if (logFileOutput != null)
                    logFileOutput.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}

@@ -56,32 +56,54 @@
 ufferedWriter;%0D%0A
+import java.io.File;%0D%0A
 import java.io.F
@@ -106,32 +106,32 @@
 io.FileWriter;%0D%0A
-
 import java.io.I
@@ -604,20 +604,8 @@
 %0D%0A%0D%0A
-    %0D%0A    %0D%0A
     
@@ -1392,11 +1392,2054 @@
 %0A    %7D%0D%0A
+    %0D%0A        public static void startNewLog () %7B%0D%0A        //Create Time Stamp%0D%0A        Date timeStamp = new Date();%0D%0A        String content = (%22 --- NEW LOG STARTED %5B%22 + timeStamp + %22%5D ---%22);%0D%0A        try %7B%0D%0A            logFileOutput = new FileWriter(%22system.log%22, true);%0D%0A            logFileWriter = new BufferedWriter(logFileOutput);%0D%0A            logFileWriter.newLine();%0D%0A            logFileWriter.write(content);%0D%0A            logFileWriter.newLine();%0D%0A        %7D catch (IOException e) %7B%0D%0A            e.printStackTrace();%0D%0A        %7D finally %7B%0D%0A            try %7B%0D%0A                if (logFileWriter != null)%0D%0A                    logFileWriter.close();%0D%0A                if (logFileOutput != null)%0D%0A                    logFileOutput.close();%0D%0A            %7D catch (IOException ex) %7B%0D%0A                ex.printStackTrace();%0D%0A            %7D%0D%0A        %7D%0D%0A    %7D%0D%0A        %0D%0A        static void clearFile () %7B%0D%0A            File logFile = new File (%22system.log%22);%0D%0A            //If log file does not exist, who cares, as we will make it later%0D%0A            if (logFile.exists()) %7B%0D%0A                if (logFile.length() %3E 102400) %7B //Size of 100 kb, will delete the file if so%0D%0A                    if (!logFile.delete()) %7B%0D%0A                        //Well, something is wrong, as it should be able to delete. Will there have a exception?%0D%0A                        //Anyway, report it%0D%0A                        System.err.println(%22Unable to delete log file%22);%0D%0A                    %7D else %7B%0D%0A                        try %7B%0D%0A                            logFile.createNewFile();%0D%0A                            log(%22Cleared file of things.%22);%0D%0A                            System.out.println(%22Zyun.Lam.Game.MonsterQuest.SystemLog.clearFile() : Cleared file of things%22);%0D%0A                        %7D catch (IOException ioe) %7B%0D%0A                            System.err.println(%22Unable to open file: %22 + ioe.getMessage());%0D%0A                            //Can't write to log files.%0D%0A                        %7D%0D%0A                    %7D%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A
 %7D%0D%0A

Update SystemLog.java