Exemplo n.º 1
0
 private static void LogToFile(string msg)
 {
     if (enabled)
     {
         if (!writeToLogFile)
         {
             return;
         }
         lock (Lock)
         {
             if (_logFile == null)
             {
                 try
                 {
                     _logFile = new RandomAccessFile(LogFile(), "rw");
                     LogToFile("\r\n\r\n ********** BEGIN LOG ********** \r\n\r\n ");
                 }
                 catch (IOException e)
                 {
                     Sharpen.Runtime.PrintStackTrace(e);
                 }
             }
             msg = DateHandlerBase.Now() + "\r\n" + msg + "\r\n";
             byte[] bytes = stringIO.Write(msg);
             try
             {
                 _logFile.Write(bytes);
             }
             catch (IOException e)
             {
                 Sharpen.Runtime.PrintStackTrace(e);
             }
         }
     }
 }
Exemplo n.º 2
0
 private void Print(string msg, bool header)
 {
     if (stream != null)
     {
         if (header)
         {
             stream.WriteLine("[" + Db4oFactory.Version() + "   " + DateHandlerBase.Now() + "] "
                              );
         }
         stream.WriteLine(" " + msg);
     }
 }
Exemplo n.º 3
0
 private static string LogFile()
 {
     if (enabled)
     {
         if (logFileName != null)
         {
             return(logFileName);
         }
         logFileName = "db4oDTrace_" + DateHandlerBase.Now() + "_" + SignatureGenerator.GenerateSignature
                           () + ".log";
         logFileName = logFileName.Replace(' ', '_');
         logFileName = logFileName.Replace(':', '_');
         logFileName = logFileName.Replace('-', '_');
         return(logFilePath + logFileName);
     }
     return(null);
 }