Improve logging OUT-538
authorThomas
Fri, 01 Feb 2019 10:54:24 +0100
branchOUT-538
changeset 25623dbba3e9ed86
parent 2561 26c3a4099ae2
child 2567 c8842fc0a516
Improve logging
Extensions/MailItemExtensions.cs
ThisAddIn.cs
Wrappers/WatchedWindow.cs
     1.1 --- a/Extensions/MailItemExtensions.cs	Fri Feb 01 09:57:03 2019 +0100
     1.2 +++ b/Extensions/MailItemExtensions.cs	Fri Feb 01 10:54:24 2019 +0100
     1.3 @@ -2011,7 +2011,7 @@
     1.4                  MsgProcessor processor = new MsgProcessor();
     1.5                  if (processor.ProcessSentMessage(message, Globals.ThisAddIn.Settings.ExtraKeys, out PEPMessage msg) != Globals.ReturnStatus.Success)
     1.6                  {
     1.7 -                    Log.Error("ProcessOutgoing: Error processing message.");
     1.8 +                    Log.Error("ProcessAndSendMessageAsync: Error processing message.");
     1.9                      sendError = true;
    1.10                      return null;
    1.11                  }
    1.12 @@ -2045,13 +2045,13 @@
    1.13                  catch (Exception ex)
    1.14                  {
    1.15                      sendError = true;
    1.16 -                    Log.Error("ProcessOutgoingAsync: Error sending message. " + ex.ToString());
    1.17 +                    Log.Error("ProcessAndSendMessageAsync: Error sending message. " + ex.ToString());
    1.18                  }
    1.19              }
    1.20  
    1.21              if (sendError)
    1.22              {
    1.23 -                Log.Error("Application_ItemSend: Send failure.");
    1.24 +                Log.Error("ProcessAndSendMessageAsync: Send failure.");
    1.25                  bool cancel = false;
    1.26                  omi.Display();
    1.27  
    1.28 @@ -2066,7 +2066,7 @@
    1.29                      cancel = (result != DialogResult.Yes);
    1.30                  }
    1.31  
    1.32 -                Log.Info("Application_ItemSend: Error during sending. " + (cancel ? "User aborted sending." : "user chose to send mail unencrypted."));
    1.33 +                Log.Info("ProcessAndSendMessageAsync: Error during sending. " + (cancel ? "User aborted sending." : "user chose to send mail unencrypted."));
    1.34  
    1.35                  if (cancel == false)
    1.36                  {
     2.1 --- a/ThisAddIn.cs	Fri Feb 01 09:57:03 2019 +0100
     2.2 +++ b/ThisAddIn.cs	Fri Feb 01 10:54:24 2019 +0100
     2.3 @@ -445,7 +445,7 @@
     2.4                                      {
     2.5                                          SmtpAddress = address,
     2.6                                          IsSecureStorageEnabled = false,
     2.7 -                                        IsSyncEnabled = false,                                        
     2.8 +                                        IsSyncEnabled = false,
     2.9                                          Type = Outlook.OlAccountType.olExchange.ToString(),
    2.10                                          UserName = userName
    2.11                                      });
    2.12 @@ -3333,6 +3333,7 @@
    2.13                      // If the message has already been processed, just send it out
    2.14                      if (processingState == MailItemExtensions.ProcessingState.Processed)
    2.15                      {
    2.16 +                        Log.Verbose("Application_ItemSend: Message already processed. Sending directly...");
    2.17                          return;
    2.18                      }
    2.19  
    2.20 @@ -3348,7 +3349,7 @@
    2.21                      else if (omi.GetIsForcefullyProtected())
    2.22                      {
    2.23                          // If ForceProtected, create special mail
    2.24 -                        Log.Info("Sending forcefully protected message.");
    2.25 +                        Log.Info("Application_ItemSend: Sending forcefully protected message.");
    2.26  
    2.27                          if (FPPMessage.ProcessOutgoing(omi) == Globals.ReturnStatus.Success)
    2.28                          {
    2.29 @@ -3378,16 +3379,19 @@
    2.30                              {
    2.31                                  /* If the message was marked to be processed in the background, cancel the normal
    2.32                                   * send process and process the message further in the dedicated method.
    2.33 -                                 */ 
    2.34 +                                 */
    2.35                                  if (processingState == MailItemExtensions.ProcessingState.ProcessInBackground)
    2.36                                  {
    2.37                                      cancel = true;
    2.38 +                                    Log.Verbose("Application_ItemSend: Canceling normal sending and initiating background processing.");
    2.39                                      omi.ProcessAndSendMessageAsync(message);
    2.40                                      return;
    2.41                                  }
    2.42                                  else
    2.43                                  {
    2.44                                      // Process outgoing message
    2.45 +                                    Log.Verbose("Application_ItemSend: Normal processing.");
    2.46 +
    2.47                                      MsgProcessor processor = new MsgProcessor();
    2.48                                      if (processor.ProcessSentMessage(message, Globals.ThisAddIn.Settings.ExtraKeys, out PEPMessage processedMessage) != Globals.ReturnStatus.Success)
    2.49                                      {
     3.1 --- a/Wrappers/WatchedWindow.cs	Fri Feb 01 09:57:03 2019 +0100
     3.2 +++ b/Wrappers/WatchedWindow.cs	Fri Feb 01 10:54:24 2019 +0100
     3.3 @@ -1374,6 +1374,7 @@
     3.4                                                                                                  NativeMethods.SetWindowPosFlags.IgnoreResize |
     3.5                                                                                                  NativeMethods.SetWindowPosFlags.HideWindow);
     3.6                          this.CurrentMailItem.SetProcessingState(MailItemExtensions.ProcessingState.ProcessInBackground);
     3.7 +                        Log.Verbose("MailItem_Send: Inspector window closed.");
     3.8                      }
     3.9  
    3.10                      // Set pEp options if needed