Package de.nameless.gameEngine.util

Source Code of de.nameless.gameEngine.util.Logger

package de.nameless.gameEngine.util;

import java.util.Date;

import sun.management.StackTraceElementCompositeData;

import de.nameless.gameEngine.gui.NEConsole;

public class Logger {
  private static Logger instance = new Logger();
  private static final boolean DoDebug = true;
  private static NEConsole console;
 
 
  private Logger(){
    console = new NEConsole()
    console.setVisible(true);
  }
 
  private static Logger getInstance(){
    if(instance == null) instance = new Logger();
    return instance;
 
 
  public static void log(String log){
    String info = Thread.getAllStackTraces().get(Thread.currentThread())[4].getFileName();
    info = info.substring(0, info.length()-5);
    Logger.getInstance().wirte(info + ": \t" + log);
  }
 
  private static void log(String log, boolean time){   
    if(time) Logger.getInstance().wirte(new Date().toGMTString());
    Logger.getInstance().wirte(log);
  }
 
  public static void debug(String log, boolean time){
    String info = Thread.getAllStackTraces().get(Thread.currentThread())[4].getFileName()
    info = info.substring(0, info.length()-5);
    if(DoDebug){
      log(info + ": \t" + log,time);
    }
  }
 
  public void wirte(String s){   
    console.write(s);
  }

}
TOP

Related Classes of de.nameless.gameEngine.util.Logger

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.