Ejemplo n.º 1
0
 public static void LogException(Exception ex)
 {
     stackVariable0 = Environment.get_CurrentDirectory();
     V_2            = DateTime.get_Now();
     V_0            = string.Concat(stackVariable0, "/logs/", V_2.ToString("dd-MM-yyyy"));
     if (!string.IsNullOrEmpty(V_0) && !Directory.Exists(V_0))
     {
         dummyVar0 = Directory.CreateDirectory(V_0);
     }
     V_1 = string.Concat(V_0, "/log_exceptions.json");
     try
     {
         V_3 = new FileInfo(V_1);
         V_4 = "[]";
         if (V_3.get_Exists())
         {
             V_6 = V_3.OpenText();
             try
             {
                 V_4 = V_6.ReadToEnd();
             }
             finally
             {
                 if (V_6 != null)
                 {
                     ((IDisposable)V_6).Dispose();
                 }
             }
             File.Delete(V_1);
         }
         stackVariable18 = JArray.Parse(V_4);
         stackVariable19 = new JObject();
         stackVariable19.Add(new JProperty("CreatedDateTime", (object)DateTime.get_UtcNow()));
         stackVariable19.Add(new JProperty("Details", JObject.FromObject(ex)));
         stackVariable18.Add(stackVariable19);
         V_4 = stackVariable18.ToString();
         V_7 = File.CreateText(V_1);
         try
         {
             V_7.WriteLine(V_4);
         }
         finally
         {
             if (V_7 != null)
             {
                 ((IDisposable)V_7).Dispose();
             }
         }
     }
     catch
     {
         dummyVar1 = exception_0;
         Console.Write(string.Concat("Cannot write log file ", V_1));
     }
     return;
 }