Exemple #1
0
 public void Log(string path, object data)
 {
     lock (this)
     {
         object logged;
         if (data is ICloneable)
         {
             logged = (data as ICloneable).Clone();
         }
         else
         {
             logged = data;
         }
         string qualifiedPath = path + GetThreadName();
         CurrentLog.Append(qualifiedPath, logged);
     }
 }
Exemple #2
0
 public void write(string messageFormat, params object[] variables)
 {
     try
     {
         var message = variables.isNull()
                       ? messageFormat
                       : messageFormat.format(variables);
         if (alsoWriteToDebug)
         {
             Debug.Write(message);
         }
         if (alsoShowInConsole)
         {
             Console.Write(message);
         }
         LogData.Append(message);
         try
         {
             if (TargetFile.file_Doesnt_Exist())
             {
                 ("---------------------------------".line() +
                  "Logger_File_Append started at {0}".line().line().format(DateTime.Now)).saveAs(TargetFile);
             }
             using (var file = File.AppendText(TargetFile))
             {
                 file.Write(message);
                 file.Close();
             }
         }
         catch (Exception ex)
         {
             Debug.Write("ERROR IN [Logger_DiagnosticsDebug][File.AppendText " + ex.Message);
         }
     }
     catch (Exception ex)
     {
         Debug.Write("[FluentSharp][ERROR IN Logger_DiagnosticsDebug] " + ex.Message);
     }
 }
Exemple #3
0
 public void write(string message)
 {
     LogData.Append(message);
 }