Example #1
0
        /// <summary>
        /// The actual logging to file procedure, with threading decision handled in the wrapper
        /// </summary>
        /// <param name="ex">The exception to log</param>
        private void actualLogToFile(WPCException ex)
        {
            try
            {
                if (!loadDocument())
                {
                    createDocument();
                }
                if (buffer.Count > 0)
                {
                    foreach (WPCException bufferedEx in buffer)
                    {
                        this.loadedDoc.Element("GuardianLog").Add(bufferedEx.convertToElement());
                    }
                    buffer.Clear();
                }
                this.loadedDoc.Element("GuardianLog").Add(ex.convertToElement());
                if (ex.isCritical())
                {
                    refreshParameterXML();
                    saveLoadedDoc();
                }
            }
#pragma warning disable
            catch (IsolatedStorageException isoEx)
#pragma warning restore
            {
                //Some apps will use the isolated storage on startup, preventing logging, so we write the event to a buffer for next time
                buffer.Add(ex);
            }
        }
Example #2
0
 /// <summary>
 /// The actual logging to file procedure, with threading decision handled in the wrapper
 /// </summary>
 /// <param name="ex">The exception to log</param>
 private void actualLogToFile(WPCException ex)
 {
     try
     {
         if (!loadDocument())
         {
             createDocument();
         }
         if (buffer.Count > 0)
         {
             foreach (WPCException bufferedEx in buffer)
             {
                 this.loadedDoc.Element("WPCLog").Add(bufferedEx.convertToElement());
             }
             buffer.Clear();
         }
         this.loadedDoc.Element("WPCLog").Add(ex.convertToElement());
         if (ex.isCritical())
         {
             refreshParameterXML();
             saveLoadedDoc();
         }
     }
     #pragma warning disable
     catch (IsolatedStorageException isoEx)
     #pragma warning restore
     {
         //Some apps will use the isolated storage on startup, preventing logging, so we write the event to a buffer for next time
         buffer.Add(ex);
     }
 }