00001 /* 00002 * $Id: RCLog_8java-source.html,v 1.2 2002/07/07 20:59:52 stork Exp $ 00003 * 00004 * $Log: RCLog_8java-source.html,v $ 00004 * Revision 1.2 2002/07/07 20:59:52 stork 00004 * update dokumenation 00004 * 00005 * Revision 1.6 2002/07/04 16:57:09 transier 00006 * disable logging for performance 00007 * 00008 * Revision 1.5 2002/07/03 19:07:36 stork 00009 * enable flush for log file 00010 * 00011 * Revision 1.4 2002/07/03 17:21:04 stork 00012 * add some debug messages 00013 * 00014 * Revision 1.3 2002/07/02 20:54:16 stork 00015 * add syncronize to RCLog 00016 * 00017 * Revision 1.2 2002/06/22 20:15:41 stork 00018 * add some more dokumentation 00019 * 00020 * Revision 1.1 2002/06/08 14:38:49 stork 00021 * basic logging class 00022 * 00023 */ 00024 import java.io.*; 00025 import java.util.*; 00026 00031 class RCLog{ 00032 protected BufferedWriter Writer; 00033 protected File LogFile; 00034 public boolean activeLog; 00035 // public boolean activeDebug; 00036 00040 public RCLog(){ 00041 try{ 00042 activeLog = true; 00043 // activeDebug = true; 00044 GregorianCalendar Cal = new GregorianCalendar(); 00045 LogFile = new File("RCTeam.log"); 00046 if( LogFile.exists() ) 00047 LogFile.delete(); 00048 LogFile.createNewFile(); 00049 Writer = new BufferedWriter(new FileWriter(LogFile)); 00050 Log("--- Log start at " + Cal.getTime()); 00051 }catch(IOException e){ 00052 System.out.println("canīt open log file"); 00053 Writer = null; 00054 } 00055 } 00056 00057 00063 public synchronized void Log( String Message ){ 00064 // try{ 00065 // if( (Writer != null) && (LogFile.canWrite()) && (activeLog == true) ){ 00066 // Writer.write(Message+"\n"); 00067 // Writer.flush(); 00068 // } 00069 // }catch(IOException e){ 00070 00071 // } 00072 } 00073 00074 /* 00075 * insert a debug message to the logfile 00076 * 00077 * @param Message 00078 */ 00079 public synchronized void Debug( String Message ){ 00080 Log("*** DEBUG : "+Message); 00081 } 00082 }