Example #1
0
 static public void Entry(ClassExp.EXP_CODES code, SEV_CODES sev, string msg, string loc, string who)
 {
     lock (HelperLock)
     {
         try
         {
             if (MAX_SEV.Equals(-1) || MAX_SEV >= Convert.ToInt32(sev))
             {
                 string fmtMsg = "";
                 if (code != ClassExp.EXP_CODES.EXP_OK)
                 {
                     fmtMsg += code.ToString() + ": ";
                 }
                 if (loc.Length > 0)
                 {
                     fmtMsg += " : (- " + loc + " -) ";
                 }
                 if (who.Length > 0)
                 {
                     fmtMsg += " : (id-" + who + " -) ";
                 }
                 fmtMsg += msg;
                 LogLedger entry = new LogLedger(Convert.ToInt32(sev), fmtMsg);
                 /* Write to Database */
                 CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("AzureWebJobsStorage"));
                 CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();
                 CloudTable          table          = tableClient.GetTableReference(LogTableName);
                 TableOperation      addOperation   = TableOperation.Insert(entry);
                 table.ExecuteAsync(addOperation);
             }
         }
         catch { }// Not much recourse if this fails.
     }
 }
Example #2
0
 /// <summary>
 /// Place the entry into the log.
 /// </summary>
 static public void Entry(ClassExp.EXP_CODES code, SEV_CODES sev, string msg, string loc)
 {
     Entry(code, sev, msg, loc, "");
 }